Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
18b971c6
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看板
提交
18b971c6
编写于
5月 31, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): check the version range when dump partial rows of file block to sdata block directly.
上级
fc20ca84
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
51 addition
and
3 deletion
+51
-3
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+51
-3
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
18b971c6
...
...
@@ -1121,6 +1121,27 @@ static int32_t getEndPosInDataBlock(STsdbReader* pReader, SBlockData* pBlockData
endPos
=
doBinarySearchKey
(
pBlockData
->
aTSKEY
,
pBlock
->
nRow
,
pos
,
key
,
pReader
->
order
);
}
if
((
pReader
->
verRange
.
maxVer
>=
pBlock
->
minVer
&&
pReader
->
verRange
.
maxVer
<
pBlock
->
maxVer
)
||
(
pReader
->
verRange
.
minVer
<=
pBlock
->
maxVer
&&
pReader
->
verRange
.
minVer
>
pBlock
->
minVer
))
{
int32_t
i
=
endPos
;
if
(
asc
)
{
for
(;
i
>=
0
;
--
i
)
{
if
(
pBlockData
->
aVersion
[
i
]
<=
pReader
->
verRange
.
maxVer
)
{
break
;
}
}
}
else
{
for
(;
i
<
pBlock
->
nRow
;
++
i
)
{
if
(
pBlockData
->
aVersion
[
i
]
>=
pReader
->
verRange
.
minVer
)
{
break
;
}
}
}
endPos
=
i
;
}
return
endPos
;
}
...
...
@@ -1260,10 +1281,11 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
return
0
;
}
// row index of dump info remain the initial position, let's find the appropriate start position.
if
((
pDumpInfo
->
rowIndex
==
0
&&
asc
)
||
(
pDumpInfo
->
rowIndex
==
pBlock
->
nRow
-
1
&&
(
!
asc
)))
{
if
(
asc
&&
pReader
->
window
.
skey
<=
pBlock
->
minKey
.
ts
)
{
if
(
asc
&&
pReader
->
window
.
skey
<=
pBlock
->
minKey
.
ts
&&
pReader
->
verRange
.
minVer
<=
pBlock
->
minVer
)
{
// pDumpInfo->rowIndex = 0;
}
else
if
(
!
asc
&&
pReader
->
window
.
ekey
>=
pBlock
->
maxKey
.
ts
)
{
}
else
if
(
!
asc
&&
pReader
->
window
.
ekey
>=
pBlock
->
maxKey
.
ts
&&
pReader
->
verRange
.
maxVer
>=
pBlock
->
maxVer
)
{
// pDumpInfo->rowIndex = pBlock->nRow - 1;
}
else
{
// find the appropriate the start position in current block, and set it to be the current rowIndex
int32_t
pos
=
asc
?
pBlock
->
nRow
-
1
:
0
;
...
...
@@ -1279,6 +1301,29 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
pBlock
->
maxVer
,
pReader
->
idStr
);
return
TSDB_CODE_INVALID_PARA
;
}
ASSERT
(
pReader
->
verRange
.
minVer
<=
pBlock
->
maxVer
&&
pReader
->
verRange
.
maxVer
>=
pBlock
->
minVer
);
// find the appropriate start position that satisfies the version requirement.
if
((
pReader
->
verRange
.
maxVer
>=
pBlock
->
minVer
&&
pReader
->
verRange
.
maxVer
<
pBlock
->
maxVer
)
||
(
pReader
->
verRange
.
minVer
<=
pBlock
->
maxVer
&&
pReader
->
verRange
.
minVer
>
pBlock
->
minVer
))
{
int32_t
i
=
pDumpInfo
->
rowIndex
;
if
(
asc
)
{
for
(;
i
<
pBlock
->
nRow
;
++
i
)
{
if
(
pBlockData
->
aVersion
[
i
]
>=
pReader
->
verRange
.
minVer
)
{
break
;
}
}
}
else
{
for
(;
i
>=
0
;
--
i
)
{
if
(
pBlockData
->
aVersion
[
i
]
<=
pReader
->
verRange
.
maxVer
)
{
break
;
}
}
}
pDumpInfo
->
rowIndex
=
i
;
}
}
}
...
...
@@ -1293,6 +1338,9 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
int32_t
dumpedRows
=
asc
?
(
endIndex
-
pDumpInfo
->
rowIndex
)
:
(
pDumpInfo
->
rowIndex
-
endIndex
);
if
(
dumpedRows
>
pReader
->
resBlockInfo
.
capacity
)
{
// output buffer check
dumpedRows
=
pReader
->
resBlockInfo
.
capacity
;
}
else
if
(
dumpedRows
<=
0
)
{
// no qualified rows in current data block, abort directly.
setBlockAllDumped
(
pDumpInfo
,
pReader
->
window
.
ekey
,
pReader
->
order
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
i
=
0
;
...
...
@@ -1848,7 +1896,7 @@ static bool isCleanFileDataBlock(STsdbReader* pReader, SFileDataBlockInfo* pBloc
SDataBlockToLoadInfo
info
=
{
0
};
getBlockToLoadInfo
(
&
info
,
pBlockInfo
,
pBlock
,
pScanInfo
,
keyInBuf
,
pLastBlockReader
,
pReader
);
bool
isCleanFileBlock
=
!
(
info
.
overlapWithNeighborBlock
||
info
.
hasDupTs
||
info
.
overlapWithKeyInBuf
||
info
.
overlapWithDelInfo
||
info
.
overlapWithLastBlock
||
info
.
partiallyRequired
);
info
.
overlapWithDelInfo
||
info
.
overlapWithLastBlock
);
return
isCleanFileBlock
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录