Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fbd3aac0
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看板
提交
fbd3aac0
编写于
10月 13, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query):set the correct active block index and add some logs.
上级
187735de
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
11 deletion
+26
-11
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+24
-9
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+2
-2
未找到文件。
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
fbd3aac0
...
...
@@ -103,10 +103,20 @@ static SBlockData* loadLastBlock(SLDataIter *pIter, const char* idStr) {
SSttBlockLoadInfo
*
pInfo
=
pIter
->
pBlockLoadInfo
;
if
(
pInfo
->
blockIndex
[
0
]
==
pIter
->
iSttBlk
)
{
if
(
pInfo
->
currentLoadBlockIndex
!=
0
)
{
tsdbDebug
(
"current load index is set to 0, block index:%d, file index:%d, due to uid:%"
PRIu64
", load data, %s"
,
pIter
->
iSttBlk
,
pIter
->
iStt
,
pIter
->
uid
,
idStr
);
pInfo
->
currentLoadBlockIndex
=
0
;
}
return
&
pInfo
->
blockData
[
0
];
}
if
(
pInfo
->
blockIndex
[
1
]
==
pIter
->
iSttBlk
)
{
if
(
pInfo
->
currentLoadBlockIndex
!=
1
)
{
tsdbDebug
(
"current load index is set to 1, block index:%d, file index:%d, due to uid:%"
PRIu64
", load data, %s"
,
pIter
->
iSttBlk
,
pIter
->
iStt
,
pIter
->
uid
,
idStr
);
pInfo
->
currentLoadBlockIndex
=
1
;
}
return
&
pInfo
->
blockData
[
1
];
}
...
...
@@ -130,12 +140,15 @@ static SBlockData* loadLastBlock(SLDataIter *pIter, const char* idStr) {
pInfo
->
elapsedTime
+=
el
;
pInfo
->
loadBlocks
+=
1
;
tsdbDebug
(
"read last block, index:%d, last file index:%d, elapsed time:%.2f ms, %s"
,
pIter
->
iSttBlk
,
pIter
->
iStt
,
el
,
idStr
);
tsdbDebug
(
"read last block, total load:%d, trigger by uid:%"
PRIu64
", last file index:%d, last block index:%d, entry:%d, %p, elapsed time:%.2f ms, %s"
,
pInfo
->
loadBlocks
,
pIter
->
uid
,
pIter
->
iStt
,
pIter
->
iSttBlk
,
pInfo
->
currentLoadBlockIndex
,
pBlock
,
el
,
idStr
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_exit
;
}
pInfo
->
blockIndex
[
pInfo
->
currentLoadBlockIndex
]
=
pIter
->
iSttBlk
;
tsdbDebug
(
"last block index list:%d, %d, %s"
,
pInfo
->
blockIndex
[
0
],
pInfo
->
blockIndex
[
1
],
idStr
);
pIter
->
iRow
=
(
pIter
->
backward
)
?
pInfo
->
blockData
[
pInfo
->
currentLoadBlockIndex
].
nRow
:
-
1
;
}
...
...
@@ -323,8 +336,10 @@ void tLDataIterClose(SLDataIter *pIter) {
taosMemoryFree
(
pIter
);
}
void
tLDataIterNextBlock
(
SLDataIter
*
pIter
)
{
void
tLDataIterNextBlock
(
SLDataIter
*
pIter
,
const
char
*
idStr
)
{
int32_t
step
=
pIter
->
backward
?
-
1
:
1
;
int32_t
oldIndex
=
pIter
->
iSttBlk
;
pIter
->
iSttBlk
+=
step
;
int32_t
index
=
-
1
;
...
...
@@ -371,6 +386,10 @@ void tLDataIterNextBlock(SLDataIter *pIter) {
if
(
index
!=
-
1
)
{
pIter
->
iSttBlk
=
index
;
pIter
->
pSttBlk
=
(
SSttBlk
*
)
taosArrayGet
(
pIter
->
pBlockLoadInfo
->
aSttBlk
,
pIter
->
iSttBlk
);
tsdbDebug
(
"try next last file block:%d from %d, trigger by uid:%"
PRIu64
", file index:%d, %s"
,
pIter
->
iSttBlk
,
oldIndex
,
pIter
->
uid
,
pIter
->
iStt
,
idStr
);
}
else
{
tsdbDebug
(
"no more last block qualified, uid:%"
PRIu64
", file index::%d, %s"
,
pIter
->
uid
,
oldIndex
,
idStr
);
}
}
...
...
@@ -394,15 +413,11 @@ static void findNextValidRow(SLDataIter *pIter, const char* idStr) {
for
(;
i
<
pBlockData
->
nRow
&&
i
>=
0
;
i
+=
step
)
{
if
(
pBlockData
->
aUid
!=
NULL
)
{
if
(
!
pIter
->
backward
)
{
/*if (pBlockData->aUid[i] < pIter->uid) {
continue;
} else */
if
(
pBlockData
->
aUid
[
i
]
>
pIter
->
uid
)
{
if
(
pBlockData
->
aUid
[
i
]
>
pIter
->
uid
)
{
break
;
}
}
else
{
/*if (pBlockData->aUid[i] > pIter->uid) {
continue;
} else */
if
(
pBlockData
->
aUid
[
i
]
<
pIter
->
uid
)
{
if
(
pBlockData
->
aUid
[
i
]
<
pIter
->
uid
)
{
break
;
}
}
...
...
@@ -457,7 +472,7 @@ bool tLDataIterNextRow(SLDataIter *pIter, const char* idStr) {
findNextValidRow
(
pIter
,
idStr
);
if
(
pIter
->
iRow
>=
pBlockData
->
nRow
||
pIter
->
iRow
<
0
)
{
tLDataIterNextBlock
(
pIter
);
tLDataIterNextBlock
(
pIter
,
idStr
);
if
(
pIter
->
pSttBlk
==
NULL
)
{
// no more data
goto
_exit
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
fbd3aac0
...
...
@@ -845,8 +845,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
if
((
pDumpInfo
->
rowIndex
==
0
&&
asc
)
||
(
pDumpInfo
->
rowIndex
==
pBlock
->
nRow
-
1
&&
(
!
asc
)))
{
if
(
asc
&&
pReader
->
window
.
skey
<=
pBlock
->
minKey
.
ts
)
{
//pDumpInfo->rowIndex = 0;
}
else
if
(
!
asc
&&
pReader
->
window
.
ekey
>=
pBlock
->
maxKey
.
ts
)
{
}
else
if
(
!
asc
&&
pReader
->
window
.
ekey
>=
pBlock
->
maxKey
.
ts
)
{
//pDumpInfo->rowIndex = pBlock->nRow - 1;
}
else
{
int32_t
pos
=
asc
?
pBlock
->
nRow
-
1
:
0
;
...
...
@@ -1644,6 +1643,7 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
STSRow
*
pTSRow
=
NULL
;
SRowMerger
merge
=
{
0
};
TSDBROW
fRow
=
tMergeTreeGetRow
(
&
pLastBlockReader
->
mergeTree
);
tsdbTrace
(
"fRow ptr:%p, %d, uid:%"
PRIu64
", %s"
,
fRow
.
pBlockData
,
fRow
.
iRow
,
pLastBlockReader
->
uid
,
pReader
->
idStr
);
// only last block exists
if
((
!
mergeBlockData
)
||
(
tsLastBlock
!=
pBlockData
->
aTSKEY
[
pDumpInfo
->
rowIndex
]))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录