Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ffb655ba
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看板
提交
ffb655ba
编写于
4月 03, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
552ea096
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
94 addition
and
19 deletion
+94
-19
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
+77
-7
source/dnode/vnode/src/tsdb/dev/tsdbUtil.h
source/dnode/vnode/src/tsdb/dev/tsdbUtil.h
+17
-12
未找到文件。
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
浏览文件 @
ffb655ba
...
...
@@ -21,11 +21,6 @@ extern int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, const uint8_t *pBuf,
extern
int32_t
tsdbReadFile
(
STsdbFD
*
pFD
,
int64_t
offset
,
uint8_t
*
pBuf
,
int64_t
size
);
extern
int32_t
tsdbFsyncFile
(
STsdbFD
*
pFD
);
typedef
struct
SFDataPtr
{
int64_t
offset
;
int64_t
size
;
}
SFDataPtr
;
typedef
struct
{
SFDataPtr
dict
[
4
];
// 0:bloom filter, 1:SSttBlk, 2:STbStatisBlk, 3:SDelBlk
uint8_t
reserved
[
32
];
...
...
@@ -106,16 +101,91 @@ _exit:
static
int32_t
write_statistics_block
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
int32_t
lino
;
STbStatisBlk
*
pStatisBlk
=
(
STbStatisBlk
*
)
taosArrayReserve
(
pWriter
->
aStatisBlk
,
1
);
if
(
pStatisBlk
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
pStatisBlk
->
nRow
=
pWriter
->
sData
.
nRow
;
pStatisBlk
->
minTid
.
suid
=
pWriter
->
sData
.
aData
[
0
][
0
];
pStatisBlk
->
minTid
.
uid
=
pWriter
->
sData
.
aData
[
1
][
0
];
pStatisBlk
->
maxTid
.
suid
=
pWriter
->
sData
.
aData
[
0
][
pWriter
->
sData
.
nRow
-
1
];
pStatisBlk
->
maxTid
.
uid
=
pWriter
->
sData
.
aData
[
1
][
pWriter
->
sData
.
nRow
-
1
];
pStatisBlk
->
minVer
=
pStatisBlk
->
maxVer
=
pStatisBlk
->
maxVer
=
pWriter
->
sData
.
aData
[
2
][
0
];
for
(
int32_t
iRow
=
1
;
iRow
<
pWriter
->
sData
.
nRow
;
iRow
++
)
{
if
(
pStatisBlk
->
minVer
>
pWriter
->
sData
.
aData
[
2
][
iRow
])
pStatisBlk
->
minVer
=
pWriter
->
sData
.
aData
[
2
][
iRow
];
if
(
pStatisBlk
->
maxVer
<
pWriter
->
sData
.
aData
[
2
][
iRow
])
pStatisBlk
->
maxVer
=
pWriter
->
sData
.
aData
[
2
][
iRow
];
}
pStatisBlk
->
dp
.
offset
=
pWriter
->
config
.
file
.
size
;
pStatisBlk
->
dp
.
size
=
0
;
// TODO
int64_t
tsize
=
sizeof
(
int64_t
)
*
pWriter
->
sData
.
nRow
;
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
pWriter
->
sData
.
aData
);
i
++
)
{
code
=
tsdbWriteFile
(
pWriter
->
pFd
,
pWriter
->
config
.
file
.
size
,
(
const
uint8_t
*
)
pWriter
->
sData
.
aData
[
i
],
tsize
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
pStatisBlk
->
dp
.
size
+=
tsize
;
pWriter
->
config
.
file
.
size
+=
tsize
;
}
tTbStatisBlockClear
(
&
pWriter
->
sData
);
// TODO
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
config
.
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
else
{
// tsdbTrace();
}
return
code
;
}
static
int32_t
write_delete_block
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
// TODO
int32_t
lino
;
SDelBlk
*
pDelBlk
=
taosArrayReserve
(
pWriter
->
aDelBlk
,
1
);
if
(
pDelBlk
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
pDelBlk
->
nRow
=
pWriter
->
sData
.
nRow
;
pDelBlk
->
minTid
.
suid
=
pWriter
->
sData
.
aData
[
0
][
0
];
pDelBlk
->
minTid
.
uid
=
pWriter
->
sData
.
aData
[
1
][
0
];
pDelBlk
->
maxTid
.
suid
=
pWriter
->
sData
.
aData
[
0
][
pWriter
->
sData
.
nRow
-
1
];
pDelBlk
->
maxTid
.
uid
=
pWriter
->
sData
.
aData
[
1
][
pWriter
->
sData
.
nRow
-
1
];
pDelBlk
->
minVer
=
pDelBlk
->
maxVer
=
pDelBlk
->
maxVer
=
pWriter
->
sData
.
aData
[
2
][
0
];
for
(
int32_t
iRow
=
1
;
iRow
<
pWriter
->
sData
.
nRow
;
iRow
++
)
{
if
(
pDelBlk
->
minVer
>
pWriter
->
sData
.
aData
[
2
][
iRow
])
pDelBlk
->
minVer
=
pWriter
->
sData
.
aData
[
2
][
iRow
];
if
(
pDelBlk
->
maxVer
<
pWriter
->
sData
.
aData
[
2
][
iRow
])
pDelBlk
->
maxVer
=
pWriter
->
sData
.
aData
[
2
][
iRow
];
}
pDelBlk
->
dp
.
offset
=
pWriter
->
config
.
file
.
size
;
pDelBlk
->
dp
.
size
=
0
;
// TODO
int64_t
tsize
=
sizeof
(
int64_t
)
*
pWriter
->
dData
.
nRow
;
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
pWriter
->
dData
.
aData
);
i
++
)
{
code
=
tsdbWriteFile
(
pWriter
->
pFd
,
pWriter
->
config
.
file
.
size
,
(
const
uint8_t
*
)
pWriter
->
dData
.
aData
[
i
],
tsize
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
pDelBlk
->
dp
.
size
+=
tsize
;
pWriter
->
config
.
file
.
size
+=
tsize
;
}
tDelBlockDestroy
(
&
pWriter
->
dData
);
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
config
.
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
else
{
// tsdbTrace();
}
return
code
;
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbUtil.h
浏览文件 @
ffb655ba
...
...
@@ -26,6 +26,11 @@ extern "C" {
typedef
struct
SDelBlock
SDelBlock
;
typedef
struct
SDelBlk
SDelBlk
;
typedef
struct
SFDataPtr
{
int64_t
offset
;
int64_t
size
;
}
SFDataPtr
;
int32_t
tDelBlockCreate
(
SDelBlock
*
pDelBlock
,
int32_t
capacity
);
int32_t
tDelBlockDestroy
(
SDelBlock
*
pDelBlock
);
int32_t
tDelBlockClear
(
SDelBlock
*
pDelBlock
);
...
...
@@ -52,12 +57,12 @@ struct SDelBlock {
};
struct
SDelBlk
{
int
64_t
suidMax
;
int64_t
suidMin
;
int64_t
uidMax
;
int64_t
uidMin
;
int64_t
verMax
;
int64_t
verMin
;
int
32_t
nRow
;
TABLEID
minTid
;
TABLEID
maxTid
;
int64_t
minVer
;
int64_t
maxVer
;
SFDataPtr
dp
;
};
struct
STbStatisBlock
{
int32_t
capacity
;
...
...
@@ -65,12 +70,12 @@ struct STbStatisBlock {
int64_t
*
aData
[
7
];
// [suid, uid, skey, sver, ekey, ever, count]
};
struct
STbStatisBlk
{
int
64_t
suidMax
;
int64_t
suidMin
;
int64_t
uidMax
;
int64_t
uidMin
;
int64_t
offset
;
int64_t
size
;
int
32_t
nRow
;
TABLEID
minTid
;
TABLEID
maxTid
;
int64_t
minVer
;
int64_t
maxVer
;
SFDataPtr
dp
;
};
#ifdef __cplusplus
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录