Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b2cf2818
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看板
提交
b2cf2818
编写于
9月 01, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(query): do some internal refactor.
上级
c7350ef2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
5 addition
and
23 deletion
+5
-23
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+5
-23
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
b2cf2818
...
@@ -84,8 +84,6 @@ typedef struct SBlockLoadSuppInfo {
...
@@ -84,8 +84,6 @@ typedef struct SBlockLoadSuppInfo {
}
SBlockLoadSuppInfo
;
}
SBlockLoadSuppInfo
;
typedef
struct
SLastBlockReader
{
typedef
struct
SLastBlockReader
{
int32_t
currentBlockIndex
;
SBlockData
lastBlockData
;
STimeWindow
window
;
STimeWindow
window
;
SVersionRange
verRange
;
SVersionRange
verRange
;
int32_t
order
;
int32_t
order
;
...
@@ -345,11 +343,6 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, SArray* aDFileSet,
...
@@ -345,11 +343,6 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, SArray* aDFileSet,
pLReader
->
order
=
pReader
->
order
;
pLReader
->
order
=
pReader
->
order
;
pLReader
->
window
=
pReader
->
window
;
pLReader
->
window
=
pReader
->
window
;
pLReader
->
verRange
=
pReader
->
verRange
;
pLReader
->
verRange
=
pReader
->
verRange
;
int32_t
code
=
tBlockDataCreate
(
&
pLReader
->
lastBlockData
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
}
}
tsdbDebug
(
"init fileset iterator, total files:%d %s"
,
pIter
->
numOfFiles
,
pReader
->
idStr
);
tsdbDebug
(
"init fileset iterator, total files:%d %s"
,
pIter
->
numOfFiles
,
pReader
->
idStr
);
...
@@ -1269,15 +1262,13 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
...
@@ -1269,15 +1262,13 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
SFileBlockDumpInfo
*
pDumpInfo
=
&
pReader
->
status
.
fBlockDumpInfo
;
SFileBlockDumpInfo
*
pDumpInfo
=
&
pReader
->
status
.
fBlockDumpInfo
;
int64_t
tsLast
=
INT64_MIN
;
int64_t
tsLast
=
INT64_MIN
;
if
(
(
pLastBlockReader
->
lastBlockData
.
nRow
>
0
)
&&
hasDataInLastBlock
(
pLastBlockReader
))
{
if
(
hasDataInLastBlock
(
pLastBlockReader
))
{
tsLast
=
getCurrentKeyInLastBlock
(
pLastBlockReader
);
tsLast
=
getCurrentKeyInLastBlock
(
pLastBlockReader
);
}
}
TSDBKEY
k
=
TSDBROW_KEY
(
pRow
);
TSDBKEY
k
=
TSDBROW_KEY
(
pRow
);
TSDBROW
fRow
=
tsdbRowFromBlockData
(
pBlockData
,
pDumpInfo
->
rowIndex
);
TSDBROW
fRow
=
tsdbRowFromBlockData
(
pBlockData
,
pDumpInfo
->
rowIndex
);
SBlockData
*
pLastBlockData
=
&
pLastBlockReader
->
lastBlockData
;
int64_t
minKey
=
0
;
int64_t
minKey
=
0
;
if
(
pReader
->
order
==
TSDB_ORDER_ASC
)
{
if
(
pReader
->
order
==
TSDB_ORDER_ASC
)
{
minKey
=
INT64_MAX
;
// chosen the minimum value
minKey
=
INT64_MAX
;
// chosen the minimum value
...
@@ -1408,7 +1399,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader
...
@@ -1408,7 +1399,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader
if
(
pBlockData
->
nRow
>
0
)
{
if
(
pBlockData
->
nRow
>
0
)
{
// no last block available, only data block exists
// no last block available, only data block exists
if
(
pLastBlockReader
->
lastBlockData
.
nRow
==
0
||
(
!
hasDataInLastBlock
(
pLastBlockReader
)
))
{
if
(
!
hasDataInLastBlock
(
pLastBlockReader
))
{
return
mergeRowsInFileBlocks
(
pBlockData
,
pBlockScanInfo
,
key
,
pReader
);
return
mergeRowsInFileBlocks
(
pBlockData
,
pBlockScanInfo
,
key
,
pReader
);
}
}
...
@@ -1458,8 +1449,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
...
@@ -1458,8 +1449,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
TSDBROW
*
piRow
=
getValidMemRow
(
&
pBlockScanInfo
->
iiter
,
pDelList
,
pReader
);
TSDBROW
*
piRow
=
getValidMemRow
(
&
pBlockScanInfo
->
iiter
,
pDelList
,
pReader
);
ASSERT
(
pRow
!=
NULL
&&
piRow
!=
NULL
);
ASSERT
(
pRow
!=
NULL
&&
piRow
!=
NULL
);
SBlockData
*
pLastBlockData
=
&
pLastBlockReader
->
lastBlockData
;
int64_t
tsLast
=
INT64_MIN
;
int64_t
tsLast
=
INT64_MIN
;
if
(
hasDataInLastBlock
(
pLastBlockReader
))
{
if
(
hasDataInLastBlock
(
pLastBlockReader
))
{
tsLast
=
getCurrentKeyInLastBlock
(
pLastBlockReader
);
tsLast
=
getCurrentKeyInLastBlock
(
pLastBlockReader
);
}
}
...
@@ -1781,14 +1771,6 @@ static bool initLastBlockReader(SLastBlockReader* pLastBlockReader, uint64_t uid
...
@@ -1781,14 +1771,6 @@ static bool initLastBlockReader(SLastBlockReader* pLastBlockReader, uint64_t uid
}
}
pLastBlockReader
->
uid
=
uid
;
pLastBlockReader
->
uid
=
uid
;
if
(
*
startPos
==
-
1
)
{
if
(
ASCENDING_TRAVERSE
(
pLastBlockReader
->
order
))
{
// do nothing
}
else
{
*
startPos
=
pLastBlockReader
->
lastBlockData
.
nRow
;
}
}
/*int32_t code = */
tMergeTreeOpen
(
&
pLastBlockReader
->
mergeTree
,
(
pLastBlockReader
->
order
==
TSDB_ORDER_DESC
),
/*int32_t code = */
tMergeTreeOpen
(
&
pLastBlockReader
->
mergeTree
,
(
pLastBlockReader
->
order
==
TSDB_ORDER_DESC
),
pFReader
,
uid
,
&
pLastBlockReader
->
window
,
&
pLastBlockReader
->
verRange
);
pFReader
,
uid
,
&
pLastBlockReader
->
window
,
&
pLastBlockReader
->
verRange
);
bool
hasVal
=
tMergeTreeNext
(
&
pLastBlockReader
->
mergeTree
);
bool
hasVal
=
tMergeTreeNext
(
&
pLastBlockReader
->
mergeTree
);
...
@@ -2535,7 +2517,7 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) {
...
@@ -2535,7 +2517,7 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) {
bool
hasNext
=
blockIteratorNext
(
&
pReader
->
status
.
blockIter
);
bool
hasNext
=
blockIteratorNext
(
&
pReader
->
status
.
blockIter
);
if
(
hasNext
)
{
// check for the next block in the block accessed order list
if
(
hasNext
)
{
// check for the next block in the block accessed order list
initBlockDumpInfo
(
pReader
,
pBlockIter
);
initBlockDumpInfo
(
pReader
,
pBlockIter
);
}
else
if
(
1
/*taosArrayGetSize(pReader->status.fileIter.pLastBlockReader->pBlockL) > 0*/
)
{
}
else
if
(
hasDataInLastBlock
(
pReader
->
status
.
fileIter
.
pLastBlockReader
)
)
{
// data blocks in current file are exhausted, let's try the next file now
// data blocks in current file are exhausted, let's try the next file now
tBlockDataReset
(
&
pReader
->
status
.
fileBlockData
);
tBlockDataReset
(
&
pReader
->
status
.
fileBlockData
);
resetDataBlockIterator
(
pBlockIter
,
pReader
->
order
);
resetDataBlockIterator
(
pBlockIter
,
pReader
->
order
);
...
@@ -3316,6 +3298,7 @@ void tsdbReaderClose(STsdbReader* pReader) {
...
@@ -3316,6 +3298,7 @@ void tsdbReaderClose(STsdbReader* pReader) {
taosMemoryFreeClear
(
pSupInfo
->
buildBuf
[
i
]);
taosMemoryFreeClear
(
pSupInfo
->
buildBuf
[
i
]);
}
}
}
}
taosMemoryFree
(
pSupInfo
->
buildBuf
);
taosMemoryFree
(
pSupInfo
->
buildBuf
);
tBlockDataDestroy
(
&
pReader
->
status
.
fileBlockData
,
true
);
tBlockDataDestroy
(
&
pReader
->
status
.
fileBlockData
,
true
);
...
@@ -3333,7 +3316,6 @@ void tsdbReaderClose(STsdbReader* pReader) {
...
@@ -3333,7 +3316,6 @@ void tsdbReaderClose(STsdbReader* pReader) {
SFilesetIter
*
pFilesetIter
=
&
pReader
->
status
.
fileIter
;
SFilesetIter
*
pFilesetIter
=
&
pReader
->
status
.
fileIter
;
if
(
pFilesetIter
->
pLastBlockReader
!=
NULL
)
{
if
(
pFilesetIter
->
pLastBlockReader
!=
NULL
)
{
tBlockDataDestroy
(
&
pFilesetIter
->
pLastBlockReader
->
lastBlockData
,
true
);
taosMemoryFree
(
pFilesetIter
->
pLastBlockReader
);
taosMemoryFree
(
pFilesetIter
->
pLastBlockReader
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录