Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN产品汪
TDengine
提交
f72183fe
T
TDengine
项目概览
CSDN产品汪
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f72183fe
编写于
7月 21, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] enable block ts check.
上级
df80c010
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
12 deletion
+30
-12
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+30
-12
未找到文件。
src/tsdb/src/tsdbRead.c
浏览文件 @
f72183fe
...
...
@@ -831,6 +831,12 @@ static int32_t copyDataFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t cap
TSKEY
*
tsArray
=
pCols
->
cols
[
0
].
pData
;
int32_t
num
=
end
-
start
+
1
;
assert
(
num
>=
0
);
if
(
num
==
0
)
{
return
numOfRows
;
}
int32_t
requiredNumOfCols
=
taosArrayGetSize
(
pQueryHandle
->
pColumns
);
//data in buffer has greater timestamp, copy data in file block
...
...
@@ -973,7 +979,7 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity,
}
static
void
moveDataToFront
(
STsdbQueryHandle
*
pQueryHandle
,
int32_t
numOfRows
,
int32_t
numOfCols
)
{
if
(
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
))
{
if
(
numOfRows
==
0
||
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
))
{
return
;
}
...
...
@@ -1022,6 +1028,26 @@ static void updateInfoAfterMerge(STsdbQueryHandle* pQueryHandle, STableCheckInfo
cur
->
pos
=
endPos
;
}
static
void
doCheckGeneratedBlockRange
(
STsdbQueryHandle
*
pQueryHandle
)
{
SQueryFilePos
*
cur
=
&
pQueryHandle
->
cur
;
if
(
cur
->
rows
>
0
)
{
if
(
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
))
{
assert
(
cur
->
win
.
skey
>=
pQueryHandle
->
window
.
skey
&&
cur
->
win
.
ekey
<=
pQueryHandle
->
window
.
ekey
);
}
else
{
assert
(
cur
->
win
.
skey
>=
pQueryHandle
->
window
.
ekey
&&
cur
->
win
.
ekey
<=
pQueryHandle
->
window
.
skey
);
}
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pQueryHandle
->
pColumns
,
0
);
assert
(
cur
->
win
.
skey
==
((
TSKEY
*
)
pColInfoData
->
pData
)[
0
]
&&
cur
->
win
.
ekey
==
((
TSKEY
*
)
pColInfoData
->
pData
)[
cur
->
rows
-
1
]);
}
else
{
cur
->
win
=
pQueryHandle
->
window
;
int32_t
step
=
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
?
1
:-
1
;
cur
->
lastKey
=
pQueryHandle
->
window
.
ekey
+
step
;
}
}
// only return the qualified data to client in terms of query time window, data rows in the same block but do not
// be included in the query time window will be discarded
static
void
doMergeTwoLevelData
(
STsdbQueryHandle
*
pQueryHandle
,
STableCheckInfo
*
pCheckInfo
,
SCompBlock
*
pBlock
)
{
...
...
@@ -1073,6 +1099,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
// the time window should always be right order: skey <= ekey
cur
->
win
=
(
STimeWindow
)
{.
skey
=
tsArray
[
start
],
.
ekey
=
tsArray
[
end
]};
cur
->
lastKey
=
tsArray
[
endPos
];
pos
+=
(
end
-
start
+
1
)
*
step
;
cur
->
blockCompleted
=
...
...
@@ -1082,7 +1109,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
// if the buffer is not full in case of descending order query, move the data in the front of the buffer
moveDataToFront
(
pQueryHandle
,
numOfRows
,
numOfCols
);
updateInfoAfterMerge
(
pQueryHandle
,
pCheckInfo
,
numOfRows
,
pos
);
doCheckGeneratedBlockRange
(
pQueryHandle
);
return
;
}
else
if
(
pCheckInfo
->
iter
!=
NULL
||
pCheckInfo
->
iiter
!=
NULL
)
{
SSkipListNode
*
node
=
NULL
;
...
...
@@ -1175,15 +1202,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
moveDataToFront
(
pQueryHandle
,
numOfRows
,
numOfCols
);
updateInfoAfterMerge
(
pQueryHandle
,
pCheckInfo
,
numOfRows
,
pos
);
if
(
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
))
{
assert
(
cur
->
win
.
skey
>=
pQueryHandle
->
window
.
skey
&&
cur
->
win
.
ekey
<=
pQueryHandle
->
window
.
ekey
);
}
else
{
assert
(
cur
->
win
.
skey
>=
pQueryHandle
->
window
.
ekey
&&
cur
->
win
.
ekey
<=
pQueryHandle
->
window
.
skey
);
}
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pQueryHandle
->
pColumns
,
0
);
assert
(
cur
->
win
.
skey
==
((
TSKEY
*
)
pColInfoData
->
pData
)[
0
]
&&
cur
->
win
.
ekey
==
((
TSKEY
*
)
pColInfoData
->
pData
)[
cur
->
rows
-
1
]);
doCheckGeneratedBlockRange
(
pQueryHandle
);
tsdbDebug
(
"%p uid:%"
PRIu64
",tid:%d data block created, brange:%"
PRIu64
"-%"
PRIu64
" rows:%d, %p"
,
pQueryHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
cur
->
win
.
skey
,
cur
->
win
.
ekey
,
cur
->
rows
,
pQueryHandle
->
qinfo
);
...
...
@@ -2027,7 +2046,6 @@ typedef struct STableGroupSupporter {
int32_t
numOfCols
;
SColIndex
*
pCols
;
STSchema
*
pTagSchema
;
// void* tsdbMeta;
}
STableGroupSupporter
;
int32_t
tableGroupComparFn
(
const
void
*
p1
,
const
void
*
p2
,
const
void
*
param
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录