Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
552ea096
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看板
提交
552ea096
编写于
3月 30, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
88907b19
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
77 addition
and
9 deletion
+77
-9
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
+77
-9
未找到文件。
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
浏览文件 @
552ea096
...
...
@@ -27,7 +27,7 @@ typedef struct SFDataPtr {
}
SFDataPtr
;
typedef
struct
{
SFDataPtr
dict
[
4
];
// 0:bloom filter, 1:SSttBlk, 2:S
DelBlk, 3:STbStatis
Blk
SFDataPtr
dict
[
4
];
// 0:bloom filter, 1:SSttBlk, 2:S
TbStatisBlk, 3:SDel
Blk
uint8_t
reserved
[
32
];
}
SFSttFooter
;
...
...
@@ -123,34 +123,83 @@ static int32_t write_stt_blk(struct SSttFWriter *pWriter) {
int32_t
code
=
0
;
int32_t
lino
;
if
(
taosArrayGetSize
(
pWriter
->
aSttBlk
)
==
0
)
{
goto
_exit
;
pWriter
->
footer
.
dict
[
1
].
offset
=
pWriter
->
config
.
file
.
size
;
pWriter
->
footer
.
dict
[
1
].
size
=
sizeof
(
SSttBlk
)
*
taosArrayGetSize
(
pWriter
->
aSttBlk
);
if
(
pWriter
->
footer
.
dict
[
1
].
size
)
{
code
=
tsdbWriteFile
(
pWriter
->
pFd
,
pWriter
->
config
.
file
.
size
,
TARRAY_DATA
(
pWriter
->
aSttBlk
),
pWriter
->
footer
.
dict
[
1
].
size
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
pWriter
->
config
.
file
.
size
+=
pWriter
->
footer
.
dict
[
1
].
size
;
}
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
config
.
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
else
{
// tsdbDebug("vgId:%d %s done, offset:%" PRId64 " size:%" PRId64 " # of stt block:%d",
// TD_VID(pWriter->config.pTsdb->pVnode), __func__);
}
return
code
;
}
static
int32_t
write_
del_bloc
k
(
struct
SSttFWriter
*
pWriter
)
{
static
int32_t
write_
statistics_bl
k
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
int32_t
lino
;
// TODO
pWriter
->
footer
.
dict
[
2
].
offset
=
pWriter
->
config
.
file
.
size
;
pWriter
->
footer
.
dict
[
2
].
size
=
sizeof
(
STbStatisBlock
)
*
taosArrayGetSize
(
pWriter
->
aStatisBlk
);
if
(
pWriter
->
footer
.
dict
[
2
].
size
)
{
code
=
tsdbWriteFile
(
pWriter
->
pFd
,
pWriter
->
config
.
file
.
size
,
TARRAY_DATA
(
pWriter
->
aStatisBlk
),
pWriter
->
footer
.
dict
[
2
].
size
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
pWriter
->
config
.
file
.
size
+=
pWriter
->
footer
.
dict
[
2
].
size
;
}
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
config
.
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
return
code
;
}
static
int32_t
write_del_blk
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
// TODO
int32_t
lino
;
pWriter
->
footer
.
dict
[
3
].
offset
=
pWriter
->
config
.
file
.
size
;
pWriter
->
footer
.
dict
[
3
].
size
=
sizeof
(
SDelBlk
)
*
taosArrayGetSize
(
pWriter
->
aDelBlk
);
if
(
pWriter
->
footer
.
dict
[
3
].
size
)
{
code
=
tsdbWriteFile
(
pWriter
->
pFd
,
pWriter
->
config
.
file
.
size
,
TARRAY_DATA
(
pWriter
->
aDelBlk
),
pWriter
->
footer
.
dict
[
3
].
size
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
pWriter
->
config
.
file
.
size
+=
pWriter
->
footer
.
dict
[
3
].
size
;
}
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
config
.
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
return
code
;
}
static
int32_t
write_file_footer
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
tsdbWriteFile
(
pWriter
->
pFd
,
pWriter
->
config
.
file
.
size
,
(
const
uint8_t
*
)
&
pWriter
->
footer
,
sizeof
(
pWriter
->
footer
));
pWriter
->
config
.
file
.
size
+=
sizeof
(
pWriter
->
footer
);
return
code
;
}
static
int32_t
write_file_header
(
struct
SSttFWriter
*
pWriter
)
{
// TODO
return
0
;
}
static
int32_t
create_stt_fwriter
(
const
struct
SSttFWriterConf
*
pConf
,
struct
SSttFWriter
**
ppWriter
)
{
int32_t
code
=
0
;
...
...
@@ -284,12 +333,31 @@ int32_t tsdbSttFWriterClose(struct SSttFWriter **ppWriter) {
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
if
(
ppWriter
[
0
]
->
sData
.
nRow
>
0
)
{
code
=
write_statistics_block
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
if
(
ppWriter
[
0
]
->
dData
.
nRow
>
0
)
{
code
=
write_delete_block
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
code
=
write_stt_blk
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
write_statistics_blk
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
write_del_blk
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
write_file_footer
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
write_file_header
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
close_stt_fwriter
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录