Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
63802f06
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
63802f06
编写于
6月 15, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more work
上级
c268437c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
42 addition
and
61 deletion
+42
-61
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+42
-61
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
63802f06
...
@@ -346,75 +346,56 @@ _err:
...
@@ -346,75 +346,56 @@ _err:
return
code
;
return
code
;
}
}
static
FORCE_INLINE
bool
tsdbCommitIterEnd
(
SCommitter
*
pCommitter
,
STbDataIter
*
pIter
)
{
TSDBROW
*
pRow
=
tsdbTbDataIterGet
(
pIter
);
return
((
pRow
==
NULL
)
||
(
pRow
->
pTSRow
->
ts
<=
pCommitter
->
maxKey
));
}
static
int32_t
tsdbCommitTableDataImpl
(
SCommitter
*
pCommitter
,
STbDataIter
*
pIter
,
SBlockIdx
*
pBlockIdx
)
{
int32_t
code
=
0
;
TSDBROW
*
pRow
;
int32_t
iBlock
;
int32_t
nBlock
;
SBlock
*
pBlock
;
SBlock
block
;
// start(todo)
// impl
pRow
=
tsdbTbDataIterGet
(
pIter
);
if
(
iBlock
<
nBlock
)
{
pBlock
=
&
block
;
tMapDataGetItemByIdx
(
&
pCommitter
->
oBlock
,
iBlock
,
pBlock
,
tGetBlock
);
}
while
(
true
)
{
if
((
pRow
==
NULL
||
pRow
->
pTSRow
->
ts
>
pCommitter
->
maxKey
)
&&
pBlock
==
NULL
)
break
;
}
// end
return
code
;
_err:
return
code
;
}
static
int32_t
tsdbCommitTableData
(
SCommitter
*
pCommitter
,
STbData
*
pTbData
,
SBlockIdx
*
pBlockIdx
)
{
static
int32_t
tsdbCommitTableData
(
SCommitter
*
pCommitter
,
STbData
*
pTbData
,
SBlockIdx
*
pBlockIdx
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
STbDataIter
*
pIter
=
NULL
;
STbDataIter
*
pIter
=
NULL
;
STbDataIter
iter
;
STbDataIter
iter
;
TSDBROW
*
pRow
=
NULL
;
TSDBROW
*
pRow
;
SBlockIdx
blockIdx
;
int32_t
iBlock
;
int32_t
nBlock
;
SBlock
*
pBlock
;
SBlock
block
;
// c
heck
// c
reate iter if can
if
(
pTbData
)
{
if
(
pTbData
)
{
pIter
=
&
iter
;
pIter
=
&
iter
;
tsdbTbDataIterOpen
(
pTbData
,
&
(
TSDBKEY
){.
ts
=
pCommitter
->
minKey
,
.
version
=
0
},
0
,
pIter
);
tsdbTbDataIterOpen
(
pTbData
,
&
(
TSDBKEY
){.
ts
=
pCommitter
->
minKey
,
.
version
=
0
},
0
,
pIter
);
pRow
=
tsdbTbDataIterGet
(
pIter
);
if
((
pRow
==
NULL
||
pRow
->
pTSRow
->
ts
>
pCommitter
->
maxKey
)
&&
pBlockIdx
==
NULL
)
goto
_exit
;
}
}
// start
// check
tMapDataReset
(
&
pCommitter
->
oBlock
);
if
(
tsdbCommitIterEnd
(
pCommitter
,
pIter
)
&&
pBlockIdx
==
NULL
)
goto
_exit
;
tMapDataReset
(
&
pCommitter
->
nBlock
);
if
(
pBlockIdx
)
{
code
=
tsdbReadBlock
(
pCommitter
->
pReader
,
pBlockIdx
,
&
pCommitter
->
oBlock
,
NULL
);
if
(
code
)
goto
_err
;
}
if
(
pTbData
)
{
blockIdx
.
suid
=
pTbData
->
suid
;
blockIdx
.
uid
=
pTbData
->
uid
;
}
else
{
blockIdx
.
suid
=
pBlockIdx
->
suid
;
blockIdx
.
uid
=
pBlockIdx
->
uid
;
}
blockIdx
.
minKey
.
version
=
INT64_MAX
;
blockIdx
.
minKey
.
ts
=
TSKEY_MAX
;
blockIdx
.
maxKey
.
version
=
0
;
blockIdx
.
maxKey
.
ts
=
TSKEY_MIN
;
blockIdx
.
minVersion
=
INT64_MAX
;
blockIdx
.
maxVersion
=
INT64_MIN
;
blockIdx
.
offset
=
-
1
;
blockIdx
.
size
=
-
1
;
// impl (todo)
iBlock
=
0
;
nBlock
=
pCommitter
->
oBlock
.
nItem
;
do
{
pRow
=
tsdbTbDataIterGet
(
pIter
);
if
(
iBlock
<
nBlock
)
{
pBlock
=
&
block
;
code
=
tMapDataGetItemByIdx
(
&
pCommitter
->
oBlock
,
iBlock
,
pBlock
,
tGetBlock
);
if
(
code
)
goto
_err
;
}
else
{
pBlock
==
NULL
;
}
if
((
pRow
==
NULL
||
pRow
->
pTSRow
->
ts
>
pCommitter
->
maxKey
)
&&
pBlock
==
NULL
)
break
;
code
=
tsdbMergeData
(
pCommitter
,
pIter
,
pBlock
);
if
(
code
)
goto
_err
;
if
(
iBlock
<
nBlock
)
iBlock
++
;
}
while
(
true
);
// end
code
=
tsdbWriteBlock
(
pCommitter
->
pWriter
,
&
pCommitter
->
nBlock
,
NULL
,
&
blockIdx
);
if
(
code
)
goto
_err
;
code
=
tMapDataPutItem
(
&
pCommitter
->
nBlockIdx
,
&
blockIdx
,
tPutBlockIdx
);
// impl
code
=
tsdbCommitTableDataImpl
(
pCommitter
,
pIter
,
pBlockIdx
);
if
(
code
)
goto
_err
;
if
(
code
)
goto
_err
;
_exit:
_exit:
...
@@ -485,7 +466,7 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) {
...
@@ -485,7 +466,7 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) {
pTbData
=
(
STbData
*
)
taosArrayGetP
(
pMemTable
->
aTbData
,
iTbData
);
pTbData
=
(
STbData
*
)
taosArrayGetP
(
pMemTable
->
aTbData
,
iTbData
);
if
(
iBlockIdx
<
nBlockIdx
)
{
if
(
iBlockIdx
<
nBlockIdx
)
{
pBlockIdx
=
&
blockIdx
;
pBlockIdx
=
&
blockIdx
;
code
=
tMapDataGetItemByIdx
(
&
pCommitter
->
oBlockIdx
,
iBlockIdx
,
&
b
lockIdx
,
tGetBlockIdx
);
code
=
tMapDataGetItemByIdx
(
&
pCommitter
->
oBlockIdx
,
iBlockIdx
,
pB
lockIdx
,
tGetBlockIdx
);
if
(
code
)
goto
_err
;
if
(
code
)
goto
_err
;
}
else
{
}
else
{
pBlockIdx
=
NULL
;
pBlockIdx
=
NULL
;
...
@@ -529,7 +510,7 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) {
...
@@ -529,7 +510,7 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) {
iBlockIdx
++
;
iBlockIdx
++
;
if
(
iBlockIdx
<
nBlockIdx
)
{
if
(
iBlockIdx
<
nBlockIdx
)
{
pBlockIdx
=
&
blockIdx
;
pBlockIdx
=
&
blockIdx
;
code
=
tMapDataGetItemByIdx
(
&
pCommitter
->
oBlockIdx
,
iBlockIdx
,
&
b
lockIdx
,
tGetBlockIdx
);
code
=
tMapDataGetItemByIdx
(
&
pCommitter
->
oBlockIdx
,
iBlockIdx
,
pB
lockIdx
,
tGetBlockIdx
);
if
(
code
)
goto
_err
;
if
(
code
)
goto
_err
;
}
else
{
}
else
{
pBlockIdx
=
NULL
;
pBlockIdx
=
NULL
;
...
@@ -549,7 +530,7 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) {
...
@@ -549,7 +530,7 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) {
}
}
if
(
iBlockIdx
<
nBlockIdx
)
{
if
(
iBlockIdx
<
nBlockIdx
)
{
pBlockIdx
=
&
blockIdx
;
pBlockIdx
=
&
blockIdx
;
code
=
tMapDataGetItemByIdx
(
&
pCommitter
->
oBlockIdx
,
iBlockIdx
,
&
b
lockIdx
,
tGetBlockIdx
);
code
=
tMapDataGetItemByIdx
(
&
pCommitter
->
oBlockIdx
,
iBlockIdx
,
pB
lockIdx
,
tGetBlockIdx
);
if
(
code
)
goto
_err
;
if
(
code
)
goto
_err
;
}
else
{
}
else
{
pBlockIdx
=
NULL
;
pBlockIdx
=
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录