Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c3a34f50
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看板
提交
c3a34f50
编写于
6月 28, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'enh/tsdb_optimize' of
https://github.com/taosdata/TDengine
into enh/tsdb_optimize
上级
b13010c4
9116a409
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
43 addition
and
26 deletion
+43
-26
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbRead2.c
source/dnode/vnode/src/tsdb/tsdbRead2.c
+42
-25
未找到文件。
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
c3a34f50
...
...
@@ -77,6 +77,7 @@ SSttBlockLoadInfo *tCreateOneLastBlockLoadInfo(STSchema *pSchema, int16_t *colLi
}
pLoadInfo
->
aSttBlk
=
taosArrayInit
(
4
,
sizeof
(
SSttBlk
));
pLoadInfo
->
pTombBlockArray
=
taosArrayInit
(
4
,
POINTER_BYTES
);
pLoadInfo
->
pSchema
=
pSchema
;
pLoadInfo
->
colIds
=
colList
;
pLoadInfo
->
numOfCols
=
numOfCols
;
...
...
@@ -200,7 +201,6 @@ static SBlockData *loadLastBlock(SLDataIter *pIter, const char *idStr) {
}
code
=
tsdbSttFileReadBlockData
(
pIter
->
pReader
,
pIter
->
pSttBlk
,
pBlock
);
// code = tsdbReadSttBlock(pIter->pReader, pIter->iStt, pIter->pSttBlk, pBlock);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_exit
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead2.c
浏览文件 @
c3a34f50
...
...
@@ -507,7 +507,7 @@ static void clearBlockScanInfo(STableBlockScanInfo* p) {
p
->
delSkyline
=
taosArrayDestroy
(
p
->
delSkyline
);
p
->
pBlockList
=
taosArrayDestroy
(
p
->
pBlockList
);
tMapDataClear
(
&
p
->
map
Data
);
p
->
pDelData
=
taosArrayDestroy
(
p
->
pDel
Data
);
}
static
void
destroyAllBlockScanInfo
(
SSHashObj
*
pTableMap
)
{
...
...
@@ -2788,9 +2788,9 @@ static bool isValidFileBlockRow(SBlockData* pBlockData, SFileBlockDumpInfo* pDum
return
true
;
}
static
int32_t
loadTomRecordInfoFromSttFiles
(
S
SttBlockLoadInfo
*
pBlockLoadInfo
,
uint64_t
suid
,
STableBlockScanInfo
*
pBlockScanInfo
,
uint64_t
maxVer
)
{
int32_t
size
=
taosArrayGetSize
(
p
BlockLoadInfo
->
pTombBlockArray
);
static
int32_t
loadTomRecordInfoFromSttFiles
(
S
Array
*
pLDataIterList
,
uint64_t
suid
,
STableBlockScanInfo
*
pBlockScanInfo
,
uint64_t
maxVer
)
{
int32_t
size
=
taosArrayGetSize
(
p
LDataIterList
);
if
(
size
<=
0
)
{
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2800,32 +2800,49 @@ static int32_t loadTomRecordInfoFromSttFiles(SSttBlockLoadInfo* pBlockLoadInfo,
pBlockScanInfo
->
pDelData
=
taosArrayInit
(
4
,
sizeof
(
SDelData
));
}
STombRecord
record
=
{
0
};
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
S
TombBlock
*
pBlock
=
taosArrayGetP
(
pBlockLoadInfo
->
pTombBlockArray
,
i
);
S
Array
*
pLeveledLDataIter
=
taosArrayGetP
(
pLDataIterList
,
i
);
STombRecord
record
=
{
0
};
for
(
int32_t
j
=
0
;
j
<
pBlock
->
suid
->
size
;
++
j
)
{
int32_t
code
=
tTombBlockGet
(
pBlock
,
j
,
&
record
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// todo handle error
}
int32_t
numOfIter
=
taosArrayGetSize
(
pLeveledLDataIter
);
if
(
numOfIter
==
0
)
{
continue
;
}
if
(
record
.
suid
<
suid
)
{
continue
;
}
for
(
int32_t
f
=
0
;
f
<
numOfIter
;
++
f
)
{
SLDataIter
*
pIter
=
taosArrayGetP
(
pLeveledLDataIter
,
f
);
// todo use binary search instead here
if
(
record
.
uid
<
uid
)
{
continue
;
}
SArray
*
pTombBlockArray
=
pIter
->
pBlockLoadInfo
->
pTombBlockArray
;
i
f
(
record
.
uid
>
uid
)
{
break
;
}
i
nt32_t
numOfBlocks
=
taosArrayGetSize
(
pTombBlockArray
);
for
(
int32_t
k
=
0
;
k
<
numOfBlocks
;
++
k
)
{
STombBlock
*
pBlock
=
taosArrayGetP
(
pTombBlockArray
,
k
);
if
(
record
.
version
<=
maxVer
)
{
SDelData
delData
=
{.
version
=
record
.
version
,
.
sKey
=
record
.
skey
,
.
eKey
=
record
.
ekey
};
taosArrayPush
(
pBlockScanInfo
->
pDelData
,
&
delData
);
for
(
int32_t
j
=
0
;
j
<
pBlock
->
suid
->
size
;
++
j
)
{
int32_t
code
=
tTombBlockGet
(
pBlock
,
j
,
&
record
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// todo handle error
}
if
(
record
.
suid
<
suid
)
{
continue
;
}
// todo use binary search instead here
if
(
record
.
uid
<
uid
)
{
continue
;
}
if
(
record
.
uid
>
uid
)
{
break
;
}
if
(
record
.
version
<=
maxVer
)
{
SDelData
delData
=
{.
version
=
record
.
version
,
.
sKey
=
record
.
skey
,
.
eKey
=
record
.
ekey
};
taosArrayPush
(
pBlockScanInfo
->
pDelData
,
&
delData
);
}
}
}
}
}
...
...
@@ -2862,7 +2879,7 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan
return
false
;
}
code
=
loadTomRecordInfoFromSttFiles
(
p
LBlockReader
->
pInfo
,
pReader
->
suid
,
pScanInfo
,
pReader
->
verRange
.
maxVer
);
code
=
loadTomRecordInfoFromSttFiles
(
p
Reader
->
status
.
pLDataIterArray
,
pReader
->
suid
,
pScanInfo
,
pReader
->
verRange
.
maxVer
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
false
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录