Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
632c6fb4
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看板
提交
632c6fb4
编写于
6月 02, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
a2dafefe
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
73 addition
and
67 deletion
+73
-67
source/dnode/vnode/src/tsdb/dev/inc/tsdbDataFileRW.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbDataFileRW.h
+1
-1
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttFileRW.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttFileRW.h
+1
-1
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
+1
-7
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
+45
-32
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
+12
-16
source/dnode/vnode/src/tsdb/dev/tsdbSttFileRW.c
source/dnode/vnode/src/tsdb/dev/tsdbSttFileRW.c
+13
-10
未找到文件。
source/dnode/vnode/src/tsdb/dev/inc/tsdbDataFileRW.h
浏览文件 @
632c6fb4
...
...
@@ -68,7 +68,7 @@ typedef struct SDataFileWriterConfig {
}
SDataFileWriterConfig
;
int32_t
tsdbDataFileWriterOpen
(
const
SDataFileWriterConfig
*
config
,
SDataFileWriter
**
writer
);
int32_t
tsdbDataFileWriterClose
(
SDataFileWriter
**
writer
,
bool
abort
,
STFileOp
op
[
/*TSDB_FTYPE_MAX*/
]
);
int32_t
tsdbDataFileWriterClose
(
SDataFileWriter
**
writer
,
bool
abort
,
TFileOpArray
*
opArr
);
int32_t
tsdbDataFileWriteTSData
(
SDataFileWriter
*
writer
,
SRowInfo
*
row
);
int32_t
tsdbDataFileWriteTSDataBlock
(
SDataFileWriter
*
writer
,
SBlockData
*
bData
);
int32_t
tsdbDataFileFlushTSDataBlock
(
SDataFileWriter
*
writer
);
...
...
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttFileRW.h
浏览文件 @
632c6fb4
...
...
@@ -60,7 +60,7 @@ typedef struct SSttFileWriter SSttFileWriter;
typedef
struct
SSttFileWriterConfig
SSttFileWriterConfig
;
int32_t
tsdbSttFileWriterOpen
(
const
SSttFileWriterConfig
*
config
,
SSttFileWriter
**
writer
);
int32_t
tsdbSttFileWriterClose
(
SSttFileWriter
**
writer
,
int8_t
abort
,
STFileOp
*
op
);
int32_t
tsdbSttFileWriterClose
(
SSttFileWriter
**
writer
,
int8_t
abort
,
TFileOpArray
*
opArray
);
int32_t
tsdbSttFileWriteTSData
(
SSttFileWriter
*
writer
,
SRowInfo
*
row
);
int32_t
tsdbSttFileWriteTSDataBlock
(
SSttFileWriter
*
writer
,
SBlockData
*
pBlockData
);
int32_t
tsdbSttFileWriteDLData
(
SSttFileWriter
*
writer
,
TABLEID
*
tbid
,
SDelData
*
pDelData
);
...
...
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
浏览文件 @
632c6fb4
...
...
@@ -299,15 +299,9 @@ static int32_t tsdbCommitFileSetEnd(SCommitter2 *committer) {
int32_t
code
=
0
;
int32_t
lino
=
0
;
STFileOp
op
[
1
];
code
=
tsdbSttFileWriterClose
(
&
committer
->
sttWriter
,
0
,
op
);
code
=
tsdbSttFileWriterClose
(
&
committer
->
sttWriter
,
0
,
committer
->
fopArray
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
if
(
op
->
optype
!=
TSDB_FOP_NONE
)
{
code
=
TARRAY2_APPEND_PTR
(
committer
->
fopArray
,
op
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
tsdbIterMergerClose
(
&
committer
->
iterMerger
);
TARRAY2_CLEAR
(
committer
->
iterArray
,
tsdbIterClose
);
...
...
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
浏览文件 @
632c6fb4
...
...
@@ -299,13 +299,13 @@ static int32_t tsdbDataFileWriterDoOpenReader(SDataFileWriter *writer) {
code
=
tsdbDataFileReaderOpen
(
NULL
,
config
,
&
writer
->
ctx
->
reader
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tsdbDataFileReadBlockIdx
(
writer
->
ctx
->
reader
,
&
writer
->
ctx
->
blockIdxArray
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
break
;
}
}
code
=
tsdbDataFileReadBlockIdx
(
writer
->
ctx
->
reader
,
&
writer
->
ctx
->
blockIdxArray
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
_exit:
if
(
code
)
{
TSDB_ERROR_LOG
(
TD_VID
(
writer
->
config
->
tsdb
->
pVnode
),
lino
,
code
);
...
...
@@ -709,7 +709,7 @@ _exit:
return
code
;
}
static
int32_t
tsdbDataFileWriterCloseCommit
(
SDataFileWriter
*
writer
,
STFileOp
*
op
)
{
static
int32_t
tsdbDataFileWriterCloseCommit
(
SDataFileWriter
*
writer
,
TFileOpArray
*
opArr
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
TABLEID
tbid
[
1
]
=
{{
INT64_MAX
,
INT64_MAX
}};
...
...
@@ -726,64 +726,81 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, STFileOp *
code
=
tsdbDataFileWriteFooter
(
writer
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
STFileOp
op
;
int32_t
ftype
;
// .head
int32_t
ftype
=
TSDB_FTYPE_HEAD
;
op
[
ftype
]
=
(
STFileOp
){
ftype
=
TSDB_FTYPE_HEAD
;
if
(
writer
->
config
->
files
[
ftype
].
exist
)
{
op
=
(
STFileOp
){
.
optype
=
TSDB_FOP_REMOVE
,
.
fid
=
writer
->
config
->
fid
,
.
of
=
writer
->
config
->
files
[
ftype
].
file
,
};
code
=
TARRAY2_APPEND
(
opArr
,
op
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
op
=
(
STFileOp
){
.
optype
=
TSDB_FOP_CREATE
,
.
fid
=
writer
->
config
->
fid
,
.
nf
=
writer
->
files
[
ftype
],
};
code
=
TARRAY2_APPEND
(
opArr
,
op
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
// .data
ftype
=
TSDB_FTYPE_DATA
;
if
(
writer
->
fd
[
ftype
])
{
if
(
!
writer
->
config
->
files
[
ftype
].
exist
)
{
op
[
ftype
]
=
(
STFileOp
){
op
=
(
STFileOp
){
.
optype
=
TSDB_FOP_CREATE
,
.
fid
=
writer
->
config
->
fid
,
.
nf
=
writer
->
files
[
ftype
],
};
}
else
if
(
writer
->
config
->
files
[
ftype
].
file
.
size
==
writer
->
files
[
ftype
].
size
)
{
op
[
ftype
].
optype
=
TSDB_FOP_NONE
;
}
else
{
op
[
ftype
]
=
(
STFileOp
){
code
=
TARRAY2_APPEND
(
opArr
,
op
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
else
if
(
writer
->
config
->
files
[
ftype
].
file
.
size
!=
writer
->
files
[
ftype
].
size
)
{
op
=
(
STFileOp
){
.
optype
=
TSDB_FOP_MODIFY
,
.
fid
=
writer
->
config
->
fid
,
.
of
=
writer
->
config
->
files
[
ftype
].
file
,
.
nf
=
writer
->
files
[
ftype
],
};
code
=
TARRAY2_APPEND
(
opArr
,
op
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
else
{
op
[
ftype
].
optype
=
TSDB_FOP_NONE
;
}
// .sma
ftype
=
TSDB_FTYPE_SMA
;
if
(
writer
->
fd
[
ftype
])
{
if
(
!
writer
->
config
->
files
[
ftype
].
exist
)
{
op
[
ftype
]
=
(
STFileOp
){
op
=
(
STFileOp
){
.
optype
=
TSDB_FOP_CREATE
,
.
fid
=
writer
->
config
->
fid
,
.
nf
=
writer
->
files
[
ftype
],
};
}
else
if
(
writer
->
config
->
files
[
ftype
].
file
.
size
==
writer
->
files
[
ftype
].
size
)
{
op
[
ftype
].
optype
=
TSDB_FOP_NONE
;
}
else
{
op
[
ftype
]
=
(
STFileOp
){
code
=
TARRAY2_APPEND
(
opArr
,
op
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
else
if
(
writer
->
config
->
files
[
ftype
].
file
.
size
!=
writer
->
files
[
ftype
].
size
)
{
op
=
(
STFileOp
){
.
optype
=
TSDB_FOP_MODIFY
,
.
fid
=
writer
->
config
->
fid
,
.
of
=
writer
->
config
->
files
[
ftype
].
file
,
.
nf
=
writer
->
files
[
ftype
],
};
code
=
TARRAY2_APPEND
(
opArr
,
op
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
else
{
op
[
ftype
].
optype
=
TSDB_FOP_NONE
;
}
// .tomb
op
[
TSDB_FTYPE_TOMB
]
=
(
STFileOp
){
.
optype
=
TSDB_FOP_NONE
,
};
// .tomb (TODO)
ftype
=
TSDB_FTYPE_TOMB
;
for
(
int32_t
i
=
0
;
i
<
TSDB_FTYPE_MAX
;
++
i
)
{
if
(
!
writer
->
fd
[
i
])
continue
;
...
...
@@ -807,25 +824,21 @@ int32_t tsdbDataFileWriterOpen(const SDataFileWriterConfig *config, SDataFileWri
return
0
;
}
int32_t
tsdbDataFileWriterClose
(
SDataFileWriter
**
writer
,
bool
abort
,
STFileOp
op
[
/*TSDB_FTYPE_MAX*/
]
)
{
int32_t
tsdbDataFileWriterClose
(
SDataFileWriter
**
writer
,
bool
abort
,
TFileOpArray
*
opArr
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
if
(
!
writer
[
0
]
->
ctx
->
opened
)
{
for
(
int32_t
i
=
0
;
i
<
TSDB_FTYPE_MAX
;
++
i
)
{
op
[
i
].
optype
=
TSDB_FOP_NONE
;
}
}
else
{
if
(
writer
[
0
]
->
ctx
->
opened
)
{
if
(
abort
)
{
code
=
tsdbDataFileWriterCloseAbort
(
writer
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
else
{
code
=
tsdbDataFileWriterCloseCommit
(
writer
[
0
],
op
);
code
=
tsdbDataFileWriterCloseCommit
(
writer
[
0
],
op
Arr
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
tsdbDataFileWriterDoClose
(
writer
[
0
]);
}
taosMemoryFree
(
writer
);
taosMemoryFree
(
writer
[
0
]
);
writer
[
0
]
=
NULL
;
_exit:
...
...
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
浏览文件 @
632c6fb4
...
...
@@ -270,7 +270,16 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) {
merger
->
ctx
->
toData
=
true
;
merger
->
ctx
->
level
=
0
;
TARRAY2_FOREACH
(
merger
->
ctx
->
fset
->
lvlArr
,
merger
->
ctx
->
lvl
)
{
// TARRAY2_FOREACH(merger->ctx->fset->lvlArr, merger->ctx->lvl) {
for
(
int32_t
i
=
0
;;
++
i
)
{
if
(
i
>=
TARRAY2_SIZE
(
merger
->
ctx
->
fset
->
lvlArr
))
{
merger
->
ctx
->
lvl
=
NULL
;
break
;
}
merger
->
ctx
->
lvl
=
TARRAY2_GET
(
merger
->
ctx
->
fset
->
lvlArr
,
i
);
if
(
merger
->
ctx
->
lvl
->
level
!=
merger
->
ctx
->
level
||
TARRAY2_SIZE
(
merger
->
ctx
->
lvl
->
fobjArr
)
==
0
)
{
merger
->
ctx
->
toData
=
false
;
merger
->
ctx
->
lvl
=
NULL
;
...
...
@@ -486,25 +495,12 @@ static int32_t tsdbMergeFileSetEndCloseWriter(SMerger *merger) {
int32_t
lino
=
0
;
int32_t
vid
=
TD_VID
(
merger
->
tsdb
->
pVnode
);
STFileOp
op
[
TSDB_FTYPE_MAX
];
code
=
tsdbSttFileWriterClose
(
&
merger
->
sttWriter
,
0
,
op
);
code
=
tsdbSttFileWriterClose
(
&
merger
->
sttWriter
,
0
,
merger
->
fopArr
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
if
(
op
->
optype
!=
TSDB_FOP_NONE
)
{
code
=
TARRAY2_APPEND_PTR
(
merger
->
fopArr
,
op
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
if
(
merger
->
ctx
->
toData
)
{
// TODO
code
=
tsdbDataFileWriterClose
(
&
merger
->
dataWriter
,
0
,
op
);
code
=
tsdbDataFileWriterClose
(
&
merger
->
dataWriter
,
0
,
merger
->
fopArr
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
if
(
op
->
optype
!=
TSDB_FOP_NONE
)
{
code
=
TARRAY2_APPEND_PTR
(
merger
->
fopArr
,
op
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
_exit:
...
...
source/dnode/vnode/src/tsdb/dev/tsdbSttFileRW.c
浏览文件 @
632c6fb4
...
...
@@ -621,7 +621,7 @@ static int32_t tsdbSttFileDoUpdateHeader(SSttFileWriter *writer) {
return
0
;
}
static
int32_t
tsdbSttFWriterCloseCommit
(
SSttFileWriter
*
writer
,
STFileOp
*
op
)
{
static
int32_t
tsdbSttFWriterCloseCommit
(
SSttFileWriter
*
writer
,
TFileOpArray
*
opArray
)
{
int32_t
lino
;
int32_t
code
;
int32_t
vid
=
TD_VID
(
writer
->
config
->
tsdb
->
pVnode
);
...
...
@@ -656,10 +656,15 @@ static int32_t tsdbSttFWriterCloseCommit(SSttFileWriter *writer, STFileOp *op) {
tsdbCloseFile
(
&
writer
->
fd
);
ASSERT
(
writer
->
config
->
file
.
size
<
writer
->
file
->
size
);
op
->
optype
=
writer
->
config
->
file
.
size
?
TSDB_FOP_MODIFY
:
TSDB_FOP_CREATE
;
op
->
fid
=
writer
->
config
->
file
.
fid
;
op
->
of
=
writer
->
config
->
file
;
op
->
nf
=
writer
->
file
[
0
];
STFileOp
op
=
{
.
optype
=
writer
->
config
->
file
.
size
?
TSDB_FOP_MODIFY
:
TSDB_FOP_CREATE
,
.
fid
=
writer
->
config
->
file
.
fid
,
.
of
=
writer
->
config
->
file
,
.
nf
=
writer
->
file
[
0
],
};
code
=
TARRAY2_APPEND
(
opArray
,
op
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
_exit:
if
(
code
)
{
...
...
@@ -694,19 +699,17 @@ int32_t tsdbSttFileWriterOpen(const SSttFileWriterConfig *config, SSttFileWriter
return
0
;
}
int32_t
tsdbSttFileWriterClose
(
SSttFileWriter
**
writer
,
int8_t
abort
,
STFileOp
*
op
)
{
int32_t
tsdbSttFileWriterClose
(
SSttFileWriter
**
writer
,
int8_t
abort
,
TFileOpArray
*
opArray
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
int32_t
vid
=
TD_VID
(
writer
[
0
]
->
config
->
tsdb
->
pVnode
);
if
(
!
writer
[
0
]
->
ctx
->
opened
)
{
if
(
op
)
op
->
optype
=
TSDB_FOP_NONE
;
}
else
{
if
(
writer
[
0
]
->
ctx
->
opened
)
{
if
(
abort
)
{
code
=
tsdbSttFWriterCloseAbort
(
writer
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
else
{
code
=
tsdbSttFWriterCloseCommit
(
writer
[
0
],
op
);
code
=
tsdbSttFWriterCloseCommit
(
writer
[
0
],
op
Array
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
tsdbSttFWriterDoClose
(
writer
[
0
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录