Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7de0fc7d
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看板
提交
7de0fc7d
编写于
8月 26, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
2e827b50
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
70 addition
and
21 deletion
+70
-21
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+70
-21
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
7de0fc7d
...
...
@@ -32,7 +32,6 @@ typedef struct {
int8_t
type
;
union
{
struct
{
SArray
*
aTbDataP
;
int32_t
iTbDataP
;
STbDataIter
iter
;
};
// memory data iter
...
...
@@ -75,6 +74,7 @@ typedef struct {
struct
{
SDataIter
*
pIter
;
SRBTree
rbt
;
SDataIter
aDataIter
[
TSDB_MAX_LAST_FILE
+
1
];
};
struct
{
SDataFWriter
*
pWriter
;
...
...
@@ -102,6 +102,26 @@ static int32_t tsdbCommitData(SCommitter *pCommitter);
static
int32_t
tsdbCommitDel
(
SCommitter
*
pCommitter
);
static
int32_t
tsdbCommitCache
(
SCommitter
*
pCommitter
);
static
int32_t
tsdbEndCommit
(
SCommitter
*
pCommitter
,
int32_t
eno
);
static
int32_t
tsdbNextCommitRow
(
SCommitter
*
pCommitter
);
static
int32_t
tRowInfoCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
SRowInfo
*
pInfo1
=
(
SRowInfo
*
)
p1
;
SRowInfo
*
pInfo2
=
(
SRowInfo
*
)
p2
;
if
(
pInfo1
->
suid
<
pInfo2
->
suid
)
{
return
-
1
;
}
else
if
(
pInfo1
->
suid
>
pInfo2
->
suid
)
{
return
1
;
}
if
(
pInfo1
->
uid
<
pInfo2
->
uid
)
{
return
-
1
;
}
else
if
(
pInfo1
->
uid
>
pInfo2
->
uid
)
{
return
1
;
}
return
tsdbRowCmprFn
(
&
pInfo1
->
row
,
&
pInfo2
->
row
);
}
int32_t
tsdbBegin
(
STsdb
*
pTsdb
)
{
int32_t
code
=
0
;
...
...
@@ -376,6 +396,49 @@ _exit:
return
code
;
}
static
int32_t
tsdbOpenCommitIter
(
SCommitter
*
pCommitter
)
{
int32_t
code
=
0
;
tRBTreeCreate
(
&
pCommitter
->
rbt
,
tRowInfoCmprFn
);
pCommitter
->
pIter
=
NULL
;
int8_t
iIter
=
0
;
// memory
SDataIter
*
pIter
=
&
pCommitter
->
aDataIter
[
iIter
];
pIter
->
type
=
0
;
pIter
->
iTbDataP
=
0
;
for
(;
pIter
->
iTbDataP
<
taosArrayGetSize
(
pCommitter
->
aTbDataP
);
pIter
->
iTbDataP
++
)
{
STbData
*
pTbData
=
(
STbData
*
)
taosArrayGetP
(
pCommitter
->
aTbDataP
,
pIter
->
iTbDataP
);
TSDBKEY
tKey
=
{.
ts
=
pCommitter
->
minKey
,
.
version
=
VERSION_MIN
};
tsdbTbDataIterOpen
(
pTbData
,
&
tKey
,
0
,
&
pIter
->
iter
);
TSDBROW
*
pRow
=
tsdbTbDataIterGet
(
&
pIter
->
iter
);
if
(
pRow
&&
TSDBROW_TS
(
pRow
)
>
pCommitter
->
maxKey
)
{
pCommitter
->
nextKey
=
TMIN
(
pCommitter
->
nextKey
,
TSDBROW_TS
(
pRow
));
continue
;
}
pIter
->
r
.
suid
=
pTbData
->
suid
;
pIter
->
r
.
uid
=
pTbData
->
uid
;
pIter
->
r
.
row
=
*
pRow
;
break
;
}
tRBTreePut
(
&
pCommitter
->
rbt
,
(
SRBTreeNode
*
)
pIter
);
// disk
if
(
0
)
{
}
code
=
tsdbNextCommitRow
(
pCommitter
);
if
(
code
)
goto
_err
;
return
code
;
_err:
return
code
;
}
static
int32_t
tsdbCommitFileDataStart
(
SCommitter
*
pCommitter
)
{
int32_t
code
=
0
;
STsdb
*
pTsdb
=
pCommitter
->
pTsdb
;
...
...
@@ -464,6 +527,10 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
tBlockDataReset
(
&
pCommitter
->
dWriter
.
bData
);
tBlockDataReset
(
&
pCommitter
->
dWriter
.
bDatal
);
// open iter
code
=
tsdbOpenCommitIter
(
pCommitter
);
if
(
code
)
goto
_err
;
_exit:
return
code
;
...
...
@@ -1325,24 +1392,6 @@ _err:
}
// ================================================================================
static
int32_t
tRowInfoCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
SRowInfo
*
pInfo1
=
(
SRowInfo
*
)
p1
;
SRowInfo
*
pInfo2
=
(
SRowInfo
*
)
p2
;
if
(
pInfo1
->
suid
<
pInfo2
->
suid
)
{
return
-
1
;
}
else
if
(
pInfo1
->
suid
>
pInfo2
->
suid
)
{
return
1
;
}
if
(
pInfo1
->
uid
<
pInfo2
->
uid
)
{
return
-
1
;
}
else
if
(
pInfo1
->
uid
>
pInfo2
->
uid
)
{
return
1
;
}
return
tsdbRowCmprFn
(
&
pInfo1
->
row
,
&
pInfo2
->
row
);
}
static
FORCE_INLINE
SRowInfo
*
tsdbGetCommitRow
(
SCommitter
*
pCommitter
)
{
return
(
pCommitter
->
pIter
)
?
&
pCommitter
->
pIter
->
r
:
NULL
;
...
...
@@ -1370,8 +1419,8 @@ static int32_t tsdbNextCommitRow(SCommitter *pCommitter) {
}
pIter
->
iTbDataP
++
;
if
(
pIter
->
iTbDataP
<
taosArrayGetSize
(
p
I
ter
->
aTbDataP
))
{
STbData
*
pTbData
=
(
STbData
*
)
taosArrayGetP
(
p
I
ter
->
aTbDataP
,
pIter
->
iTbDataP
);
if
(
pIter
->
iTbDataP
<
taosArrayGetSize
(
p
Commit
ter
->
aTbDataP
))
{
STbData
*
pTbData
=
(
STbData
*
)
taosArrayGetP
(
p
Commit
ter
->
aTbDataP
,
pIter
->
iTbDataP
);
TSDBKEY
keyFrom
=
{.
ts
=
pCommitter
->
minKey
,
.
version
=
VERSION_MIN
};
tsdbTbDataIterOpen
(
pTbData
,
&
keyFrom
,
0
,
&
pIter
->
iter
);
pRow
=
tsdbTbDataIterGet
(
&
pIter
->
iter
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录