Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3f4b4b52
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
3f4b4b52
编写于
5月 10, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
a36be0a0
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
58 addition
and
42 deletion
+58
-42
source/dnode/vnode/src/tsdb/dev/inc/tsdbCommit.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbCommit.h
+30
-0
source/dnode/vnode/src/tsdb/dev/inc/tsdbFSet.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbFSet.h
+4
-4
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttFReaderWriter.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttFReaderWriter.h
+1
-1
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
+18
-32
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
+1
-1
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
+2
-2
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
+1
-1
source/dnode/vnode/src/tsdb/dev/tsdbSttFReaderWriter.c
source/dnode/vnode/src/tsdb/dev/tsdbSttFReaderWriter.c
+1
-1
未找到文件。
source/dnode/vnode/src/tsdb/dev/inc/tsdbCommit.h
0 → 100644
浏览文件 @
3f4b4b52
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tsdbFS.h"
#include "tsdbSttFReaderWriter.h"
#ifndef _TSDB_COMMIT_H_
#define _TSDB_COMMIT_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TSDB_COMMIT_H_*/
\ No newline at end of file
source/dnode/vnode/src/tsdb/dev/inc/tsdbFSet.h
浏览文件 @
3f4b4b52
...
...
@@ -23,7 +23,7 @@ extern "C" {
#endif
typedef
struct
STFileSet
STFileSet
;
typedef
struct
S
FileOp
S
FileOp
;
typedef
struct
S
TFileOp
ST
FileOp
;
typedef
enum
{
TSDB_FOP_NONE
=
0
,
...
...
@@ -37,10 +37,10 @@ int32_t tsdbFileSetToJson(const STFileSet *fset, cJSON *json);
int32_t
tsdbFileSetFromJson
(
const
cJSON
*
json
,
STFileSet
*
fset
);
int32_t
tsdbFileSetCreate
(
int32_t
fid
,
STFileSet
**
ppSet
);
int32_t
tsdbFileSetEdit
(
STFileSet
*
pSet
,
SFileOp
*
pOp
);
int32_t
tsdbEditFileSet
(
STFileSet
*
pFileSet
,
const
SFileOp
*
pOp
);
int32_t
tsdbFileSetEdit
(
STFileSet
*
pSet
,
S
T
FileOp
*
pOp
);
int32_t
tsdbEditFileSet
(
STFileSet
*
pFileSet
,
const
S
T
FileOp
*
pOp
);
struct
SFileOp
{
struct
S
T
FileOp
{
tsdb_fop_t
op
;
int32_t
fid
;
STFile
oState
;
// old file state
...
...
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttFReaderWriter.h
浏览文件 @
3f4b4b52
...
...
@@ -47,7 +47,7 @@ typedef struct SSttFileWriter SSttFileWriter;
typedef
struct
SSttFileWriterConfig
SSttFileWriterConfig
;
int32_t
tsdbSttFWriterOpen
(
const
SSttFileWriterConfig
*
config
,
SSttFileWriter
**
ppWriter
);
int32_t
tsdbSttFWriterClose
(
SSttFileWriter
**
ppWriter
,
int8_t
abort
,
struct
SFileOp
*
op
);
int32_t
tsdbSttFWriterClose
(
SSttFileWriter
**
ppWriter
,
int8_t
abort
,
struct
S
T
FileOp
*
op
);
int32_t
tsdbSttFWriteTSData
(
SSttFileWriter
*
pWriter
,
TABLEID
*
tbid
,
TSDBROW
*
pRow
);
int32_t
tsdbSttFWriteDLData
(
SSttFileWriter
*
pWriter
,
TABLEID
*
tbid
,
SDelData
*
pDelData
);
...
...
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
浏览文件 @
3f4b4b52
...
...
@@ -13,11 +13,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "
dev
.h"
#include "
inc/tsdbCommit
.h"
// extern dependencies
typedef
struct
{
STsdb
*
pTsdb
;
// config
int32_t
minutes
;
int8_t
precision
;
...
...
@@ -25,7 +26,10 @@ typedef struct {
int32_t
maxRow
;
int8_t
cmprAlg
;
int8_t
sttTrigger
;
SArray
*
aTbDataP
;
SArray
*
aTbDataP
;
// SArray<STbData *>
SArray
*
aFileOp
;
// SArray<STFileOp>
// context
TSKEY
nextKey
;
int32_t
fid
;
...
...
@@ -33,8 +37,8 @@ typedef struct {
TSKEY
minKey
;
TSKEY
maxKey
;
STFileSet
*
pFileSet
;
// writer
SArray
*
aFileOp
;
SSttFileWriter
*
pWriter
;
}
SCommitter
;
...
...
@@ -243,7 +247,7 @@ static int32_t end_commit_file_set(SCommitter *pCommitter) {
if
(
pCommitter
->
pWriter
==
NULL
)
return
0
;
struct
SFileOp
*
pFileOp
=
taosArrayReserve
(
pCommitter
->
aFileOp
,
1
);
struct
S
T
FileOp
*
pFileOp
=
taosArrayReserve
(
pCommitter
->
aFileOp
,
1
);
if
(
pFileOp
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
...
@@ -319,17 +323,14 @@ static int32_t open_committer(STsdb *pTsdb, SCommitInfo *pInfo, SCommitter *pCom
pCommitter
->
minRow
=
pInfo
->
info
.
config
.
tsdbCfg
.
minRows
;
pCommitter
->
maxRow
=
pInfo
->
info
.
config
.
tsdbCfg
.
maxRows
;
pCommitter
->
cmprAlg
=
pInfo
->
info
.
config
.
tsdbCfg
.
compression
;
pCommitter
->
sttTrigger
=
7
;
// TODO
pCommitter
->
sttTrigger
=
2
;
// TODO
pCommitter
->
aTbDataP
=
tsdbMemTableGetTbDataArray
(
pTsdb
->
imem
);
if
(
pCommitter
->
aTbDataP
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
pCommitter
->
aFileOp
=
taosArrayInit
(
16
,
sizeof
(
struct
SFileOp
));
if
(
pCommitter
->
aFileOp
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
pCommitter
->
aFileOp
=
taosArrayInit
(
16
,
sizeof
(
STFileOp
));
if
(
pCommitter
->
aTbDataP
==
NULL
||
pCommitter
->
aFileOp
==
NULL
)
{
taosArrayDestroy
(
pCommitter
->
aTbDataP
);
taosArrayDestroy
(
pCommitter
->
aFileOp
);
TSDB_CHECK_CODE
(
code
=
TSDB_CODE_OUT_OF_MEMORY
,
lino
,
_exit
);
}
// start loop
...
...
@@ -337,17 +338,9 @@ static int32_t open_committer(STsdb *pTsdb, SCommitInfo *pInfo, SCommitter *pCom
_exit:
if
(
code
)
{
tsdbError
(
//
"vgId:%d %s failed at line %d since %s"
,
//
TD_VID
(
pTsdb
->
pVnode
),
//
__func__
,
//
lino
,
//
tstrerror
(
code
));
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
else
{
tsdbDebug
(
//
"vgId:%d %s done"
,
//
TD_VID
(
pTsdb
->
pVnode
),
//
__func__
);
tsdbDebug
(
"vgId:%d %s done"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
);
}
return
code
;
}
...
...
@@ -425,16 +418,9 @@ int32_t tsdbCommitBegin(STsdb *pTsdb, SCommitInfo *pInfo) {
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
//
TD_VID
(
pTsdb
->
pVnode
),
//
__func__
,
//
lino
,
//
tstrerror
(
code
));
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
else
{
tsdbInfo
(
"vgId:%d %s done, nRow:%"
PRId64
" nDel:%"
PRId64
,
//
TD_VID
(
pTsdb
->
pVnode
),
//
__func__
,
//
pMem
->
nRow
,
//
tsdbInfo
(
"vgId:%d %s done, nRow:%"
PRId64
" nDel:%"
PRId64
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
,
pMem
->
nRow
,
pMem
->
nDel
);
}
return
code
;
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
浏览文件 @
3f4b4b52
...
...
@@ -440,7 +440,7 @@ static int32_t edit_fs(STFileSystem *pFS, const SArray *aFileOp) {
// TODO: copy current state to new state
for
(
int32_t
iop
=
0
;
iop
<
taosArrayGetSize
(
aFileOp
);
iop
++
)
{
struct
SFileOp
*
pOp
=
taosArrayGet
(
aFileOp
,
iop
);
struct
S
T
FileOp
*
pOp
=
taosArrayGet
(
aFileOp
,
iop
);
struct
STFileSet
tmpSet
=
{.
fid
=
pOp
->
fid
};
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
浏览文件 @
3f4b4b52
...
...
@@ -58,7 +58,7 @@ _exit:
return
code
;
}
int32_t
tsdbFileSetEdit
(
struct
STFileSet
*
pSet
,
struct
SFileOp
*
pOp
)
{
int32_t
tsdbFileSetEdit
(
struct
STFileSet
*
pSet
,
struct
S
T
FileOp
*
pOp
)
{
int32_t
code
=
0
;
// TODO
return
code
;
...
...
@@ -126,7 +126,7 @@ int32_t tsdbFileSetFromJson(const cJSON *json, STFileSet *fset) {
return
0
;
}
int32_t
tsdbEditFileSet
(
struct
STFileSet
*
pFileSet
,
const
struct
SFileOp
*
pOp
)
{
int32_t
tsdbEditFileSet
(
struct
STFileSet
*
pFileSet
,
const
struct
S
T
FileOp
*
pOp
)
{
int32_t
code
=
0
;
ASSERTS
(
0
,
"TODO: Not implemented yet"
);
// TODO
...
...
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
浏览文件 @
3f4b4b52
...
...
@@ -30,7 +30,7 @@ typedef struct {
SSttFileWriter
*
pSttFWriter
;
SDataFileWriter
*
pDataFWriter
;
SArray
*
aFileOp
;
// SArray<struct SFileOp>
SArray
*
aFileOp
;
// SArray<struct S
T
FileOp>
}
SMerger
;
static
int32_t
tsdbFileSystemShouldMerge
(
STsdb
*
pTsdb
)
{
...
...
source/dnode/vnode/src/tsdb/dev/tsdbSttFReaderWriter.c
浏览文件 @
3f4b4b52
...
...
@@ -549,7 +549,7 @@ _exit:
return
code
;
}
int32_t
tsdbSttFWriterClose
(
SSttFileWriter
**
ppWriter
,
int8_t
abort
,
struct
SFileOp
*
op
)
{
int32_t
tsdbSttFWriterClose
(
SSttFileWriter
**
ppWriter
,
int8_t
abort
,
struct
S
T
FileOp
*
op
)
{
int32_t
vgId
=
TD_VID
(
ppWriter
[
0
]
->
config
.
pTsdb
->
pVnode
);
int32_t
code
=
0
;
int32_t
lino
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录