Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
88907b19
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看板
提交
88907b19
编写于
3月 30, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
8afa2c53
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
60 addition
and
4 deletion
+60
-4
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
+60
-4
未找到文件。
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
浏览文件 @
88907b19
...
...
@@ -104,6 +104,21 @@ _exit:
return
code
;
}
static
int32_t
write_statistics_block
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
tTbStatisBlockClear
(
&
pWriter
->
sData
);
// TODO
return
code
;
}
static
int32_t
write_delete_block
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
static
int32_t
write_stt_blk
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
int32_t
lino
;
...
...
@@ -217,14 +232,19 @@ static int32_t destroy_stt_fwriter(struct SSttFWriter *pWriter) {
static
int32_t
open_stt_fwriter
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
int32_t
lino
;
uint8_t
hdr
[
TSDB_FHDR_SIZE
]
=
{
0
};
int32_t
flag
=
TD_FILE_READ
|
TD_FILE_WRITE
|
TD_FILE_CREATE
|
TD_FILE_TRUNC
;
code
=
tsdbOpenFile
(
pWriter
->
config
.
file
.
fname
,
pWriter
->
config
.
szPage
,
flag
,
&
pWriter
->
pFd
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tsdbWriteFile
(
pWriter
->
pFd
,
0
,
hdr
,
sizeof
(
hdr
));
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
_exit:
if
(
code
)
{
if
(
pWriter
->
pFd
)
tsdbCloseFile
(
&
pWriter
->
pFd
);
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
config
.
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
...
...
@@ -248,8 +268,8 @@ int32_t tsdbSttFWriterOpen(const struct SSttFWriterConf *pConf, struct SSttFWrit
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pConf
->
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
if
(
ppWriter
[
0
])
destroy_stt_fwriter
(
ppWriter
[
0
]);
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pConf
->
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
return
code
;
}
...
...
@@ -287,12 +307,28 @@ int32_t tsdbSttFWriteTSData(struct SSttFWriter *pWriter, TABLEID *tbid, TSDBROW
int32_t
code
=
0
;
int32_t
lino
;
TSDBKEY
key
=
TSDBROW_KEY
(
pRow
);
if
(
!
TABLE_SAME_SCHEMA
(
pWriter
->
bData
.
suid
,
pWriter
->
bData
.
uid
,
tbid
->
suid
,
tbid
->
uid
))
{
if
(
pWriter
->
bData
.
nRow
>
0
)
{
code
=
write_timeseries_block
(
pWriter
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
if
(
pWriter
->
sData
.
nRow
>=
pWriter
->
config
.
maxRow
)
{
code
=
write_statistics_block
(
pWriter
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
pWriter
->
sData
.
aData
[
0
][
pWriter
->
sData
.
nRow
]
=
tbid
->
suid
;
// suid
pWriter
->
sData
.
aData
[
1
][
pWriter
->
sData
.
nRow
]
=
tbid
->
uid
;
// uid
pWriter
->
sData
.
aData
[
2
][
pWriter
->
sData
.
nRow
]
=
key
.
ts
;
// skey
pWriter
->
sData
.
aData
[
3
][
pWriter
->
sData
.
nRow
]
=
key
.
version
;
// sver
pWriter
->
sData
.
aData
[
4
][
pWriter
->
sData
.
nRow
]
=
key
.
ts
;
// ekey
pWriter
->
sData
.
aData
[
5
][
pWriter
->
sData
.
nRow
]
=
key
.
version
;
// ever
pWriter
->
sData
.
aData
[
6
][
pWriter
->
sData
.
nRow
]
=
1
;
// count
pWriter
->
sData
.
nRow
++
;
code
=
tsdbUpdateSkmTb
(
pWriter
->
config
.
pTsdb
,
tbid
,
pWriter
->
config
.
pSkmTb
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
...
@@ -314,6 +350,17 @@ int32_t tsdbSttFWriteTSData(struct SSttFWriter *pWriter, TABLEID *tbid, TSDBROW
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
if
(
key
.
ts
>
pWriter
->
sData
.
aData
[
4
][
pWriter
->
sData
.
nRow
-
1
])
{
pWriter
->
sData
.
aData
[
4
][
pWriter
->
sData
.
nRow
-
1
]
=
key
.
ts
;
// ekey
pWriter
->
sData
.
aData
[
5
][
pWriter
->
sData
.
nRow
-
1
]
=
key
.
version
;
// ever
pWriter
->
sData
.
aData
[
6
][
pWriter
->
sData
.
nRow
-
1
]
++
;
// count
}
else
if
(
key
.
ts
==
pWriter
->
sData
.
aData
[
4
][
pWriter
->
sData
.
nRow
-
1
])
{
pWriter
->
sData
.
aData
[
4
][
pWriter
->
sData
.
nRow
-
1
]
=
key
.
ts
;
// ekey
pWriter
->
sData
.
aData
[
5
][
pWriter
->
sData
.
nRow
-
1
]
=
key
.
version
;
// ever
}
else
{
ASSERTS
(
0
,
"timestamp should be in ascending order"
);
}
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
config
.
pTsdb
->
pVnode
),
__func__
,
lino
,
...
...
@@ -323,7 +370,16 @@ _exit:
}
int32_t
tsdbSttFWriteDLData
(
struct
SSttFWriter
*
pWriter
,
TABLEID
*
tbid
,
SDelData
*
pDelData
)
{
int32_t
code
=
0
;
// TODO
return
code
;
pWriter
->
dData
.
aData
[
0
][
pWriter
->
dData
.
nRow
]
=
tbid
->
suid
;
// suid
pWriter
->
dData
.
aData
[
1
][
pWriter
->
dData
.
nRow
]
=
tbid
->
uid
;
// uid
pWriter
->
dData
.
aData
[
2
][
pWriter
->
dData
.
nRow
]
=
pDelData
->
version
;
// version
pWriter
->
dData
.
aData
[
3
][
pWriter
->
dData
.
nRow
]
=
pDelData
->
sKey
;
// skey
pWriter
->
dData
.
aData
[
4
][
pWriter
->
dData
.
nRow
]
=
pDelData
->
eKey
;
// ekey
pWriter
->
dData
.
nRow
++
;
if
(
pWriter
->
dData
.
nRow
>=
pWriter
->
config
.
maxRow
)
{
return
write_delete_block
(
pWriter
);
}
else
{
return
0
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录