Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d3bf34e9
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看板
提交
d3bf34e9
编写于
6月 05, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
aad386e7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
53 addition
and
8 deletion
+53
-8
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
+53
-8
未找到文件。
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
浏览文件 @
d3bf34e9
...
...
@@ -433,6 +433,9 @@ static int32_t tsdbDataFileWriterDoOpen(SDataFileWriter *writer) {
.
size
=
0
,
};
// TODO: init footer
// writer->footer->blockIdxPtr->offset = 0;
_exit:
if
(
code
)
{
TSDB_ERROR_LOG
(
TD_VID
(
writer
->
config
->
tsdb
->
pVnode
),
lino
,
code
);
...
...
@@ -983,25 +986,29 @@ static int32_t tsdbDataFileWriterOpenDataFD(SDataFileWriter *writer) {
int32_t
code
=
0
;
int32_t
lino
=
0
;
for
(
int32_t
i
=
0
;
i
<
TSDB_FTYPE_TOMB
/* TODO */
;
++
i
)
{
int32_t
ftypes
[]
=
{
TSDB_FTYPE_HEAD
,
TSDB_FTYPE_DATA
,
TSDB_FTYPE_SMA
};
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
ftypes
);
++
i
)
{
int32_t
ftype
=
ftypes
[
i
];
char
fname
[
TSDB_FILENAME_LEN
];
int32_t
flag
=
TD_FILE_READ
|
TD_FILE_WRITE
;
if
(
writer
->
files
[
i
].
size
==
0
)
{
if
(
writer
->
files
[
ftype
].
size
==
0
)
{
flag
|=
(
TD_FILE_CREATE
|
TD_FILE_TRUNC
);
}
tsdbTFileName
(
writer
->
config
->
tsdb
,
&
writer
->
files
[
i
],
fname
);
tsdbTFileName
(
writer
->
config
->
tsdb
,
&
writer
->
files
[
ftype
],
fname
);
code
=
tsdbOpenFile
(
fname
,
writer
->
config
->
szPage
,
flag
,
&
writer
->
fd
[
i
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
if
(
writer
->
files
[
i
].
size
==
0
)
{
if
(
writer
->
files
[
ftype
].
size
==
0
)
{
uint8_t
hdr
[
TSDB_FHDR_SIZE
]
=
{
0
};
code
=
tsdbWriteFile
(
writer
->
fd
[
i
],
0
,
hdr
,
TSDB_FHDR_SIZE
);
code
=
tsdbWriteFile
(
writer
->
fd
[
ftype
],
0
,
hdr
,
TSDB_FHDR_SIZE
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
writer
->
files
[
i
].
size
+=
TSDB_FHDR_SIZE
;
writer
->
files
[
ftype
].
size
+=
TSDB_FHDR_SIZE
;
}
}
...
...
@@ -1132,6 +1139,43 @@ int32_t tsdbDataFileFlushTSDataBlock(SDataFileWriter *writer) {
return
tsdbDataFileWriteDataBlock
(
writer
,
writer
->
bData
);
}
static
int32_t
tsdbDataFileWriterOpenTombFD
(
SDataFileWriter
*
writer
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
char
fname
[
TSDB_FILENAME_LEN
];
int32_t
ftypes
[
2
]
=
{
TSDB_FTYPE_HEAD
,
TSDB_FTYPE_TOMB
};
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
ftypes
);
++
i
)
{
int32_t
ftype
=
ftypes
[
i
];
if
(
writer
->
fd
[
ftype
])
continue
;
int32_t
flag
=
TD_FILE_READ
|
TD_FILE_WRITE
|
TD_FILE_CREATE
|
TD_FILE_TRUNC
;
tsdbTFileName
(
writer
->
config
->
tsdb
,
writer
->
files
+
ftype
,
fname
);
code
=
tsdbOpenFile
(
fname
,
writer
->
config
->
szPage
,
flag
,
&
writer
->
fd
[
ftype
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
if
(
writer
->
files
[
ftype
].
size
==
0
)
{
uint8_t
hdr
[
TSDB_FHDR_SIZE
]
=
{
0
};
code
=
tsdbWriteFile
(
writer
->
fd
[
i
],
0
,
hdr
,
TSDB_FHDR_SIZE
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
writer
->
files
[
i
].
size
+=
TSDB_FHDR_SIZE
;
}
}
// Open iter (TODO)
_exit:
if
(
code
)
{
TSDB_ERROR_LOG
(
TD_VID
(
writer
->
config
->
tsdb
->
pVnode
),
lino
,
code
);
}
return
code
;
}
int32_t
tsdbDataFileWriteTombRecord
(
SDataFileWriter
*
writer
,
const
STombRecord
*
record
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
...
...
@@ -1142,8 +1186,9 @@ int32_t tsdbDataFileWriteTombRecord(SDataFileWriter *writer, const STombRecord *
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
if
(
writer
->
fd
[
TSDB_FTYPE_TOMB
]
==
NULL
)
{
// TODO
if
(
!
writer
->
fd
[
TSDB_FTYPE_TOMB
])
{
code
=
tsdbDataFileWriterOpenTombFD
(
writer
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录