Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bdeb1ebc
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
bdeb1ebc
编写于
9月 29, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
compare
上级
ce087d3d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
71 addition
and
5 deletion
+71
-5
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+71
-5
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
bdeb1ebc
...
...
@@ -17,6 +17,8 @@
typedef
enum
{
MEMORY_DATA_ITER
=
0
,
STT_DATA_ITER
}
EDataIterT
;
#define USE_STREAM_COMPRESSION 1
typedef
struct
{
SRBTreeNode
n
;
SRowInfo
r
;
...
...
@@ -70,12 +72,16 @@ typedef struct {
int8_t
toLastOnly
;
};
struct
{
SDataFWriter
*
pWriter
;
SArray
*
aBlockIdx
;
// SArray<SBlockIdx>
SArray
*
aSttBlk
;
// SArray<SSttBlk>
SMapData
mBlock
;
// SMapData<SDataBlk>
SBlockData
bData
;
SDataFWriter
*
pWriter
;
SArray
*
aBlockIdx
;
// SArray<SBlockIdx>
SArray
*
aSttBlk
;
// SArray<SSttBlk>
SMapData
mBlock
;
// SMapData<SDataBlk>
SBlockData
bData
;
#if USE_STREAM_COMPRESSION
SDiskDataBuilder
*
pBuilder
;
#else
SBlockData
bDatal
;
#endif
}
dWriter
;
SSkmInfo
skmTable
;
SSkmInfo
skmRow
;
...
...
@@ -542,7 +548,11 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
taosArrayClear
(
pCommitter
->
dWriter
.
aSttBlk
);
tMapDataReset
(
&
pCommitter
->
dWriter
.
mBlock
);
tBlockDataReset
(
&
pCommitter
->
dWriter
.
bData
);
#if USE_STREAM_COMPRESSION
tDiskDataBuilderClear
(
pCommitter
->
dWriter
.
pBuilder
);
#else
tBlockDataReset
(
&
pCommitter
->
dWriter
.
bDatal
);
#endif
// open iter
code
=
tsdbOpenCommitIter
(
pCommitter
);
...
...
@@ -860,7 +870,11 @@ static int32_t tsdbCommitDataStart(SCommitter *pCommitter) {
code
=
tBlockDataCreate
(
&
pCommitter
->
dWriter
.
bData
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
#if USE_STREAM_COMPRESSION
code
=
tDiskDataBuilderCreate
(
&
pCommitter
->
dWriter
.
pBuilder
);
#else
code
=
tBlockDataCreate
(
&
pCommitter
->
dWriter
.
bDatal
);
#endif
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
_exit:
...
...
@@ -889,7 +903,11 @@ static void tsdbCommitDataEnd(SCommitter *pCommitter) {
taosArrayDestroy
(
pCommitter
->
dWriter
.
aSttBlk
);
tMapDataClear
(
&
pCommitter
->
dWriter
.
mBlock
);
tBlockDataDestroy
(
&
pCommitter
->
dWriter
.
bData
,
1
);
#if USE_STREAM_COMPRESSION
tDiskDataBuilderDestroy
(
pCommitter
->
dWriter
.
pBuilder
);
#else
tBlockDataDestroy
(
&
pCommitter
->
dWriter
.
bDatal
,
1
);
#endif
tTSchemaDestroy
(
pCommitter
->
skmTable
.
pTSchema
);
tTSchemaDestroy
(
pCommitter
->
skmRow
.
pTSchema
);
}
...
...
@@ -1360,6 +1378,7 @@ static int32_t tsdbInitSttBlockBuilderIfNeed(SCommitter *pCommitter, TABLEID id)
int32_t
code
=
0
;
int32_t
lino
=
0
;
#if USE_STREAM_COMPRESSION
SDiskDataBuilder
*
pBuilder
=
pCommitter
->
dWriter
.
pBuilder
;
if
(
pBuilder
->
suid
||
pBuilder
->
uid
)
{
if
(
!
TABLE_SAME_SCHEMA
(
pBuilder
->
suid
,
pBuilder
->
uid
,
id
.
suid
,
id
.
uid
))
{
...
...
@@ -1376,6 +1395,25 @@ static int32_t tsdbInitSttBlockBuilderIfNeed(SCommitter *pCommitter, TABLEID id)
code
=
tDiskDataBuilderInit
(
pBuilder
,
pCommitter
->
skmTable
.
pTSchema
,
&
id
,
pCommitter
->
cmprAlg
,
0
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
#else
SBlockData
*
pBData
=
&
pCommitter
->
dWriter
.
bDatal
;
if
(
pBData
->
suid
||
pBData
->
uid
)
{
if
(
!
TABLE_SAME_SCHEMA
(
pBData
->
suid
,
pBData
->
uid
,
id
.
suid
,
id
.
uid
))
{
code
=
tsdbWriteSttBlock
(
pCommitter
->
dWriter
.
pWriter
,
pBData
,
pCommitter
->
dWriter
.
aSttBlk
,
pCommitter
->
cmprAlg
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
tBlockDataReset
(
pBData
);
}
}
if
(
!
pBData
->
suid
&&
!
pBData
->
uid
)
{
ASSERT
(
pCommitter
->
skmTable
.
suid
==
id
.
suid
);
ASSERT
(
pCommitter
->
skmTable
.
uid
==
id
.
uid
);
TABLEID
tid
=
{.
suid
=
id
.
suid
,
.
uid
=
id
.
suid
?
0
:
id
.
uid
};
code
=
tBlockDataInit
(
pBData
,
&
tid
,
pCommitter
->
skmTable
.
pTSchema
,
NULL
,
0
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
#endif
_exit:
if
(
code
)
{
...
...
@@ -1398,6 +1436,7 @@ static int32_t tsdbAppendLastBlock(SCommitter *pCommitter) {
for
(
int32_t
iRow
=
0
;
iRow
<
pBData
->
nRow
;
iRow
++
)
{
TSDBROW
row
=
tsdbRowFromBlockData
(
pBData
,
iRow
);
#if USE_STREAM_COMPRESSION
code
=
tDiskDataAddRow
(
pCommitter
->
dWriter
.
pBuilder
,
&
row
,
NULL
,
&
id
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
...
@@ -1408,6 +1447,16 @@ static int32_t tsdbAppendLastBlock(SCommitter *pCommitter) {
code
=
tsdbInitSttBlockBuilderIfNeed
(
pCommitter
,
id
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
#else
code
=
tBlockDataAppendRow
(
&
pCommitter
->
dWriter
.
bDatal
,
&
row
,
NULL
,
id
.
uid
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
if
(
pCommitter
->
dWriter
.
bDatal
.
nRow
>=
pCommitter
->
maxRow
)
{
code
=
tsdbWriteSttBlock
(
pCommitter
->
dWriter
.
pWriter
,
&
pCommitter
->
dWriter
.
bDatal
,
pCommitter
->
dWriter
.
aSttBlk
,
pCommitter
->
cmprAlg
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
#endif
}
_exit:
...
...
@@ -1441,7 +1490,11 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, TABLEID id) {
pTSchema
=
pCommitter
->
skmRow
.
pTSchema
;
}
#if USE_STREAM_COMPRESSION
code
=
tDiskDataAddRow
(
pCommitter
->
dWriter
.
pBuilder
,
&
pRowInfo
->
row
,
pTSchema
,
&
id
);
#else
code
=
tBlockDataAppendRow
(
&
pCommitter
->
dWriter
.
bDatal
,
&
pRowInfo
->
row
,
pTSchema
,
id
.
uid
);
#endif
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tsdbNextCommitRow
(
pCommitter
);
...
...
@@ -1452,6 +1505,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, TABLEID id) {
pRowInfo
=
NULL
;
}
#if USE_STREAM_COMPRESSION
if
(
pCommitter
->
dWriter
.
pBuilder
->
nRow
>=
pCommitter
->
maxRow
)
{
code
=
tsdbCommitSttBlk
(
pCommitter
->
dWriter
.
pWriter
,
pCommitter
->
dWriter
.
pBuilder
,
pCommitter
->
dWriter
.
aSttBlk
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
...
@@ -1459,6 +1513,13 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, TABLEID id) {
code
=
tsdbInitSttBlockBuilderIfNeed
(
pCommitter
,
id
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
#else
if
(
pCommitter
->
dWriter
.
bData
.
nRow
>=
pCommitter
->
maxRow
)
{
code
=
tsdbWriteSttBlock
(
pCommitter
->
dWriter
.
pWriter
,
&
pCommitter
->
dWriter
.
bDatal
,
pCommitter
->
dWriter
.
aSttBlk
,
pCommitter
->
cmprAlg
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
#endif
}
}
else
{
SBlockData
*
pBData
=
&
pCommitter
->
dWriter
.
bData
;
...
...
@@ -1561,7 +1622,12 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) {
code
=
tsdbMoveCommitData
(
pCommitter
,
id
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
#if USE_STREAM_COMPRESSION
code
=
tsdbCommitSttBlk
(
pCommitter
->
dWriter
.
pWriter
,
pCommitter
->
dWriter
.
pBuilder
,
pCommitter
->
dWriter
.
aSttBlk
);
#else
code
=
tsdbWriteSttBlock
(
pCommitter
->
dWriter
.
pWriter
,
&
pCommitter
->
dWriter
.
bDatal
,
pCommitter
->
dWriter
.
aSttBlk
,
pCommitter
->
cmprAlg
);
#endif
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
_exit:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录