Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
29a1245b
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
29a1245b
编写于
8月 21, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): use the separate last block delete index.
上级
79046869
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
9 deletion
+10
-9
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+10
-9
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
29a1245b
...
...
@@ -45,7 +45,8 @@ typedef struct STableBlockScanInfo {
SIterInfo
iter
;
// mem buffer skip list iterator
SIterInfo
iiter
;
// imem buffer skip list iterator
SArray
*
delSkyline
;
// delete info for this table
int32_t
fileDelIndex
;
int32_t
fileDelIndex
;
// file block delete index
int32_t
lastBlockDelIndex
;
// delete index for last block
bool
iterInit
;
// whether to initialize the in-memory skip list iterator or not
int16_t
indexInBlockL
;
// row position in last block
}
STableBlockScanInfo
;
...
...
@@ -1296,7 +1297,7 @@ static bool fileBlockShouldLoad(STsdbReader* pReader, SFileDataBlockInfo* pFBloc
// todo here we need to each key in the last files to identify if it is really overlapped with last block
bool
overlapWithlastBlock
=
false
;
if
(
taosArrayGetSize
(
pLastBlockReader
->
pBlockL
)
>
0
)
{
if
(
taosArrayGetSize
(
pLastBlockReader
->
pBlockL
)
>
0
&&
(
pLastBlockReader
->
currentBlockIndex
!=
-
1
)
)
{
SBlockL
*
pBlockL
=
taosArrayGet
(
pLastBlockReader
->
pBlockL
,
pLastBlockReader
->
currentBlockIndex
);
overlapWithlastBlock
=
!
(
pBlock
->
maxKey
.
ts
<
pBlockL
->
minKey
||
pBlock
->
minKey
.
ts
>
pBlockL
->
maxKey
);
}
...
...
@@ -1939,7 +1940,7 @@ static bool nextRowInLastBlock(SLastBlockReader *pLastBlockReader, STableBlockSc
}
TSDBKEY
k
=
{.
ts
=
ts
,
.
version
=
ver
};
if
(
hasBeenDropped
(
pBlockScanInfo
->
delSkyline
,
&
pBlockScanInfo
->
file
DelIndex
,
&
k
,
pLastBlockReader
->
order
))
{
if
(
hasBeenDropped
(
pBlockScanInfo
->
delSkyline
,
&
pBlockScanInfo
->
lastBlock
DelIndex
,
&
k
,
pLastBlockReader
->
order
))
{
continue
;
}
...
...
@@ -2295,6 +2296,7 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
ASCENDING_TRAVERSE
(
pReader
->
order
)
?
0
:
taosArrayGetSize
(
pBlockScanInfo
->
delSkyline
)
-
1
;
pBlockScanInfo
->
iiter
.
index
=
pBlockScanInfo
->
iter
.
index
;
pBlockScanInfo
->
fileDelIndex
=
pBlockScanInfo
->
iter
.
index
;
pBlockScanInfo
->
lastBlockDelIndex
=
pBlockScanInfo
->
iter
.
index
;
return
code
;
_err:
...
...
@@ -2305,9 +2307,6 @@ _err:
static
TSDBKEY
getCurrentKeyInBuf
(
STableBlockScanInfo
*
pScanInfo
,
STsdbReader
*
pReader
)
{
TSDBKEY
key
=
{.
ts
=
TSKEY_INITIAL_VAL
};
// SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(pBlockIter);
// STableBlockScanInfo* pScanInfo = taosHashGet(pReader->status.pTableMap, &pFBlock->uid, sizeof(pFBlock->uid));
initMemDataIterator
(
pScanInfo
,
pReader
);
TSDBROW
*
pRow
=
getValidRow
(
&
pScanInfo
->
iter
,
pScanInfo
->
delSkyline
,
pReader
);
if
(
pRow
!=
NULL
)
{
...
...
@@ -2381,10 +2380,12 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum) {
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
doLoadRelatedLastBlock
(
SLastBlockReader
*
pLastBlockReader
,
uint64_t
uid
,
STsdbReader
*
pReader
)
{
static
int32_t
doLoadRelatedLastBlock
(
SLastBlockReader
*
pLastBlockReader
,
STableBlockScanInfo
*
pBlockScanInfo
,
STsdbReader
*
pReader
)
{
SArray
*
pBlocks
=
pLastBlockReader
->
pBlockL
;
SBlockL
*
pBlock
=
NULL
;
uint64_t
uid
=
pBlockScanInfo
->
uid
;
initMemDataIterator
(
pBlockScanInfo
,
pReader
);
pLastBlockReader
->
currentBlockIndex
=
-
1
;
// find the correct SBlockL
...
...
@@ -2435,7 +2436,7 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
// load the last data block of current table
// todo opt perf by avoiding load last block repeatly
STableBlockScanInfo
*
pScanInfo
=
pStatus
->
pTableIter
;
int32_t
code
=
doLoadRelatedLastBlock
(
pLastBlockReader
,
pScanInfo
->
uid
,
pReader
);
int32_t
code
=
doLoadRelatedLastBlock
(
pLastBlockReader
,
pScanInfo
,
pReader
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2504,7 +2505,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
key
=
getCurrentKeyInBuf
(
pScanInfo
,
pReader
);
// load the last data block of current table
code
=
doLoadRelatedLastBlock
(
pLastBlockReader
,
pScanInfo
->
uid
,
pReader
);
code
=
doLoadRelatedLastBlock
(
pLastBlockReader
,
pScanInfo
,
pReader
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录