Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d8762b9b
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d8762b9b
编写于
4月 25, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor.
上级
6467b99a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
29 addition
and
9 deletion
+29
-9
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+4
-2
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+25
-7
未找到文件。
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
d8762b9b
...
...
@@ -261,8 +261,10 @@ int32_t tLDataIterOpen(struct SLDataIter *pIter, SDataFReader *pReader, int32_t
pIter
->
pReader
=
pReader
;
pIter
->
iStt
=
iStt
;
pIter
->
backward
=
backward
;
pIter
->
verRange
=
*
pRange
;
pIter
->
timeWindow
=
*
pTimeWindow
;
pIter
->
verRange
.
minVer
=
pRange
->
minVer
;
pIter
->
verRange
.
maxVer
=
pRange
->
maxVer
;
pIter
->
timeWindow
.
skey
=
pTimeWindow
->
skey
;
pIter
->
timeWindow
.
ekey
=
pTimeWindow
->
ekey
;
pIter
->
pBlockLoadInfo
=
pBlockLoadInfo
;
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
d8762b9b
...
...
@@ -148,6 +148,7 @@ typedef struct STableUidList {
typedef
struct
SReaderStatus
{
bool
loadFromFile
;
// check file stage
bool
composedDataBlock
;
// the returned data block is a composed block or not
bool
mapDataCleaned
;
// mapData has been cleaned up alreay or not
SSHashObj
*
pTableMap
;
// SHash<STableBlockScanInfo>
STableBlockScanInfo
**
pTableIter
;
// table iterator used in building in-memory buffer data blocks.
STableUidList
uidList
;
// check tables in uid order, to avoid the repeatly load of blocks in STT.
...
...
@@ -875,7 +876,18 @@ _end:
return
code
;
}
static
void
cleanupTableScanInfo
(
SSHashObj
*
pTableMap
)
{
static
void
doCleanupTableScanInfo
(
STableBlockScanInfo
*
pScanInfo
)
{
// reset the index in last block when handing a new file
tMapDataClear
(
&
pScanInfo
->
mapData
);
taosArrayClear
(
pScanInfo
->
pBlockList
);
}
static
void
cleanupTableScanInfo
(
SReaderStatus
*
pStatus
)
{
if
(
pStatus
->
mapDataCleaned
)
{
return
;
}
SSHashObj
*
pTableMap
=
pStatus
->
pTableMap
;
STableBlockScanInfo
**
px
=
NULL
;
int32_t
iter
=
0
;
...
...
@@ -885,10 +897,10 @@ static void cleanupTableScanInfo(SSHashObj* pTableMap) {
break
;
}
// reset the index in last block when handing a new file
tMapDataClear
(
&
(
*
px
)
->
mapData
);
taosArrayClear
((
*
px
)
->
pBlockList
);
doCleanupTableScanInfo
(
*
px
);
}
pStatus
->
mapDataCleaned
=
true
;
}
static
int32_t
doLoadFileBlock
(
STsdbReader
*
pReader
,
SArray
*
pIndexList
,
SBlockNumber
*
pBlockNum
,
SArray
*
pTableScanInfoList
)
{
...
...
@@ -896,8 +908,10 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN
size_t
numOfTables
=
taosArrayGetSize
(
pIndexList
);
int64_t
st
=
taosGetTimestampUs
();
cleanupTableScanInfo
(
pReader
->
status
.
pTableMap
);
cleanupTableScanInfo
(
&
pReader
->
status
);
// set the flag for the new file
pReader
->
status
.
mapDataCleaned
=
false
;
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
SBlockIdx
*
pBlockIdx
=
taosArrayGet
(
pIndexList
,
i
);
STableBlockScanInfo
*
pScanInfo
=
getTableBlockScanInfo
(
pReader
->
status
.
pTableMap
,
pBlockIdx
->
uid
,
pReader
->
idStr
);
...
...
@@ -3022,8 +3036,12 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
// load the last data block of current table
STableBlockScanInfo
*
pScanInfo
=
*
(
STableBlockScanInfo
**
)
pStatus
->
pTableIter
;
bool
hasVal
=
initLastBlockReader
(
pLastBlockReader
,
pScanInfo
,
pReader
);
if
(
!
hasVal
)
{
// reset the index in last block when handing a new file
doCleanupTableScanInfo
(
pScanInfo
);
pStatus
->
mapDataCleaned
=
true
;
bool
hasDataInLastFile
=
initLastBlockReader
(
pLastBlockReader
,
pScanInfo
,
pReader
);
if
(
!
hasDataInLastFile
)
{
bool
hasNexTable
=
moveToNextTable
(
pUidList
,
pStatus
);
if
(
!
hasNexTable
)
{
return
TSDB_CODE_SUCCESS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录