Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5405a967
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看板
提交
5405a967
编写于
6月 12, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact code
上级
4813af08
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
12 deletion
+24
-12
source/dnode/vnode/src/tsdb/dev/inc/tsdbIter.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbIter.h
+6
-5
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
+1
-1
source/dnode/vnode/src/tsdb/dev/tsdbIter.c
source/dnode/vnode/src/tsdb/dev/tsdbIter.c
+15
-4
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
+2
-2
未找到文件。
source/dnode/vnode/src/tsdb/dev/inc/tsdbIter.h
浏览文件 @
5405a967
...
...
@@ -55,12 +55,13 @@ int32_t tsdbIterClose(STsdbIter **iter);
int32_t
tsdbIterNext
(
STsdbIter
*
iter
);
// SIterMerger ===============
int32_t
tsdbIterMergerOpen
(
const
TTsdbIterArray
*
iterArray
,
SIterMerger
**
merger
,
bool
isTomb
);
int32_t
tsdbIterMergerClose
(
SIterMerger
**
merger
);
int32_t
tsdbIterMergerNext
(
SIterMerger
*
merger
);
SRowInfo
*
tsdbIterMergerGet
(
SIterMerger
*
merger
);
int32_t
tsdbIterMergerOpen
(
const
TTsdbIterArray
*
iterArray
,
SIterMerger
**
merger
,
bool
isTomb
);
int32_t
tsdbIterMergerClose
(
SIterMerger
**
merger
);
int32_t
tsdbIterMergerNext
(
SIterMerger
*
merger
);
int32_t
tsdbIterMergerSkipTableData
(
SIterMerger
*
merger
,
const
TABLEID
*
tbid
);
SRowInfo
*
tsdbIterMergerGetData
(
SIterMerger
*
merger
);
STombRecord
*
tsdbIterMergerGetTombRecord
(
SIterMerger
*
merger
);
int32_t
tsdbIterMergerSkipTableData
(
SIterMerger
*
merger
,
const
TABLEID
*
tbid
);
#ifdef __cplusplus
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
浏览文件 @
5405a967
...
...
@@ -178,7 +178,7 @@ static int32_t tsdbCommitTSData(SCommitter2 *committer) {
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
// loop iter
while
((
row
=
tsdbIterMergerGet
(
committer
->
iterMerger
))
!=
NULL
)
{
while
((
row
=
tsdbIterMergerGet
Data
(
committer
->
iterMerger
))
!=
NULL
)
{
if
(
row
->
uid
!=
committer
->
ctx
->
tbid
->
uid
)
{
committer
->
ctx
->
tbid
->
suid
=
row
->
suid
;
committer
->
ctx
->
tbid
->
uid
=
row
->
uid
;
...
...
source/dnode/vnode/src/tsdb/dev/tsdbIter.c
浏览文件 @
5405a967
...
...
@@ -544,6 +544,7 @@ static int32_t tsdbTombIterCmprFn(const SRBTreeNode *n1, const SRBTreeNode *n2)
// SIterMerger ================
struct
SIterMerger
{
bool
isTomb
;
STsdbIter
*
iter
;
SRBTree
iterTree
[
1
];
};
...
...
@@ -553,8 +554,11 @@ int32_t tsdbIterMergerOpen(const TTsdbIterArray *iterArray, SIterMerger **merger
SRBTreeNode
*
node
;
merger
[
0
]
=
taosMemoryCalloc
(
1
,
sizeof
(
*
merger
[
0
]));
if
(
!
merger
[
0
])
return
TSDB_CODE_OUT_OF_MEMORY
;
if
(
merger
[
0
]
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
merger
[
0
]
->
isTomb
=
isTomb
;
if
(
isTomb
)
{
tRBTreeCreate
(
merger
[
0
]
->
iterTree
,
tsdbTombIterCmprFn
);
}
else
{
...
...
@@ -599,15 +603,22 @@ int32_t tsdbIterMergerNext(SIterMerger *merger) {
}
}
if
(
!
merger
->
iter
&&
(
node
=
tRBTreeDropMin
(
merger
->
iterTree
)))
{
if
(
merger
->
iter
==
NULL
&&
(
node
=
tRBTreeDropMin
(
merger
->
iterTree
)))
{
merger
->
iter
=
TCONTAINER_OF
(
node
,
STsdbIter
,
node
);
}
return
0
;
}
SRowInfo
*
tsdbIterMergerGet
(
SIterMerger
*
merger
)
{
return
merger
->
iter
?
merger
->
iter
->
row
:
NULL
;
}
STombRecord
*
tsdbIterMergerGetTombRecord
(
SIterMerger
*
merger
)
{
return
merger
->
iter
?
merger
->
iter
->
record
:
NULL
;
}
SRowInfo
*
tsdbIterMergerGetData
(
SIterMerger
*
merger
)
{
ASSERT
(
!
merger
->
isTomb
);
return
merger
->
iter
?
merger
->
iter
->
row
:
NULL
;
}
STombRecord
*
tsdbIterMergerGetTombRecord
(
SIterMerger
*
merger
)
{
ASSERT
(
merger
->
isTomb
);
return
merger
->
iter
?
merger
->
iter
->
record
:
NULL
;
}
int32_t
tsdbIterMergerSkipTableData
(
SIterMerger
*
merger
,
const
TABLEID
*
tbid
)
{
int32_t
code
;
...
...
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
浏览文件 @
5405a967
...
...
@@ -199,7 +199,7 @@ static int32_t tsdbMergeToDataLevel(SMerger *merger) {
int32_t
lino
=
0
;
// data
for
(
SRowInfo
*
row
;
(
row
=
tsdbIterMergerGet
(
merger
->
dataIterMerger
))
!=
NULL
;)
{
for
(
SRowInfo
*
row
;
(
row
=
tsdbIterMergerGet
Data
(
merger
->
dataIterMerger
))
!=
NULL
;)
{
if
(
row
->
uid
!=
merger
->
ctx
->
tbid
->
uid
)
{
code
=
tsdbMergeToDataTableEnd
(
merger
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
...
@@ -273,7 +273,7 @@ static int32_t tsdbMergeToUpperLevel(SMerger *merger) {
// data
SRowInfo
*
row
;
while
((
row
=
tsdbIterMergerGet
(
merger
->
dataIterMerger
)))
{
while
((
row
=
tsdbIterMergerGet
Data
(
merger
->
dataIterMerger
)))
{
code
=
tsdbSttFileWriteRow
(
merger
->
sttWriter
,
row
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录