Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a0039fe2
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
提交
a0039fe2
编写于
4月 10, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
f21a6081
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
25 deletion
+25
-25
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
+12
-13
source/dnode/vnode/src/tsdb/dev/tsdbFS.h
source/dnode/vnode/src/tsdb/dev/tsdbFS.h
+13
-12
未找到文件。
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
浏览文件 @
a0039fe2
...
@@ -26,7 +26,7 @@ static int32_t create_file_system(STsdb *pTsdb, struct STFileSystem **ppFS) {
...
@@ -26,7 +26,7 @@ static int32_t create_file_system(STsdb *pTsdb, struct STFileSystem **ppFS) {
}
}
ppFS
[
0
]
->
pTsdb
=
pTsdb
;
ppFS
[
0
]
->
pTsdb
=
pTsdb
;
tsem_init
(
&
ppFS
[
0
]
->
can
E
dit
,
0
,
1
);
tsem_init
(
&
ppFS
[
0
]
->
can
_e
dit
,
0
,
1
);
return
0
;
return
0
;
}
}
...
@@ -34,7 +34,7 @@ static int32_t create_file_system(STsdb *pTsdb, struct STFileSystem **ppFS) {
...
@@ -34,7 +34,7 @@ static int32_t create_file_system(STsdb *pTsdb, struct STFileSystem **ppFS) {
static
int32_t
destroy_file_system
(
struct
STFileSystem
**
ppFS
)
{
static
int32_t
destroy_file_system
(
struct
STFileSystem
**
ppFS
)
{
if
(
ppFS
[
0
])
{
if
(
ppFS
[
0
])
{
taosArrayDestroy
(
ppFS
[
0
]
->
aFileSet
);
taosArrayDestroy
(
ppFS
[
0
]
->
aFileSet
);
tsem_destroy
(
&
ppFS
[
0
]
->
can
E
dit
);
tsem_destroy
(
&
ppFS
[
0
]
->
can
_e
dit
);
taosMemoryFree
(
ppFS
[
0
]);
taosMemoryFree
(
ppFS
[
0
]);
ppFS
[
0
]
=
NULL
;
ppFS
[
0
]
=
NULL
;
}
}
...
@@ -46,7 +46,7 @@ static int32_t get_current_json(STsdb *pTsdb, char fname[]) {
...
@@ -46,7 +46,7 @@ static int32_t get_current_json(STsdb *pTsdb, char fname[]) {
return
0
;
return
0
;
}
}
static
int32_t
get_current_temp
(
STsdb
*
pTsdb
,
char
fname
[],
EFsEditType
etype
)
{
static
int32_t
get_current_temp
(
STsdb
*
pTsdb
,
char
fname
[],
tsdb_fs_edit_t
etype
)
{
switch
(
etype
)
{
switch
(
etype
)
{
case
TSDB_FS_EDIT_COMMIT
:
case
TSDB_FS_EDIT_COMMIT
:
snprintf
(
fname
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
pTsdb
->
path
,
TD_DIRSEP
,
"current.json.commit"
);
snprintf
(
fname
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
pTsdb
->
path
,
TD_DIRSEP
,
"current.json.commit"
);
...
@@ -70,7 +70,7 @@ static int32_t load_fs_from_file(const char *fname, struct STFileSystem *pFS) {
...
@@ -70,7 +70,7 @@ static int32_t load_fs_from_file(const char *fname, struct STFileSystem *pFS) {
return
0
;
return
0
;
}
}
static
int32_t
commit_edit
(
struct
STFileSystem
*
pFS
,
EFsEditType
etype
)
{
static
int32_t
commit_edit
(
struct
STFileSystem
*
pFS
,
tsdb_fs_edit_t
etype
)
{
int32_t
code
;
int32_t
code
;
char
ofname
[
TSDB_FILENAME_LEN
];
char
ofname
[
TSDB_FILENAME_LEN
];
char
nfname
[
TSDB_FILENAME_LEN
];
char
nfname
[
TSDB_FILENAME_LEN
];
...
@@ -89,7 +89,7 @@ static int32_t commit_edit(struct STFileSystem *pFS, EFsEditType etype) {
...
@@ -89,7 +89,7 @@ static int32_t commit_edit(struct STFileSystem *pFS, EFsEditType etype) {
return
0
;
return
0
;
}
}
static
int32_t
abort_edit
(
struct
STFileSystem
*
pFS
,
EFsEditType
etype
)
{
static
int32_t
abort_edit
(
struct
STFileSystem
*
pFS
,
tsdb_fs_edit_t
etype
)
{
int32_t
code
;
int32_t
code
;
char
fname
[
TSDB_FILENAME_LEN
];
char
fname
[
TSDB_FILENAME_LEN
];
...
@@ -224,14 +224,14 @@ int32_t tsdbCloseFileSystem(struct STFileSystem **ppFS) {
...
@@ -224,14 +224,14 @@ int32_t tsdbCloseFileSystem(struct STFileSystem **ppFS) {
return
0
;
return
0
;
}
}
int32_t
tsdbFileSystemEditBegin
(
struct
STFileSystem
*
pFS
,
const
SArray
*
aFileOp
,
EFsEditType
etype
)
{
int32_t
tsdbFileSystemEditBegin
(
struct
STFileSystem
*
pFS
,
const
SArray
*
aFileOp
,
tsdb_fs_edit_t
etype
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
int32_t
lino
=
0
;
int32_t
lino
=
0
;
char
fname
[
TSDB_FILENAME_LEN
];
char
fname
[
TSDB_FILENAME_LEN
];
get_current_temp
(
pFS
->
pTsdb
,
fname
,
etype
);
get_current_temp
(
pFS
->
pTsdb
,
fname
,
etype
);
tsem_wait
(
&
pFS
->
can
E
dit
);
tsem_wait
(
&
pFS
->
can
_e
dit
);
code
=
write_fs_to_file
(
pFS
,
fname
);
code
=
write_fs_to_file
(
pFS
,
fname
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
@@ -252,9 +252,9 @@ _exit:
...
@@ -252,9 +252,9 @@ _exit:
return
code
;
return
code
;
}
}
int32_t
tsdbFileSystemEditCommit
(
struct
STFileSystem
*
pFS
,
EFsEditType
etype
)
{
int32_t
tsdbFileSystemEditCommit
(
struct
STFileSystem
*
pFS
,
tsdb_fs_edit_t
etype
)
{
int32_t
code
=
commit_edit
(
pFS
,
etype
);
int32_t
code
=
commit_edit
(
pFS
,
etype
);
tsem_post
(
&
pFS
->
can
E
dit
);
tsem_post
(
&
pFS
->
can
_e
dit
);
if
(
code
)
{
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed since %s"
,
//
tsdbError
(
"vgId:%d %s failed since %s"
,
//
TD_VID
(
pFS
->
pTsdb
->
pVnode
),
//
TD_VID
(
pFS
->
pTsdb
->
pVnode
),
//
...
@@ -269,17 +269,16 @@ int32_t tsdbFileSystemEditCommit(struct STFileSystem *pFS, EFsEditType etype) {
...
@@ -269,17 +269,16 @@ int32_t tsdbFileSystemEditCommit(struct STFileSystem *pFS, EFsEditType etype) {
return
code
;
return
code
;
}
}
int32_t
tsdbFileSystemEditAbort
(
struct
STFileSystem
*
pFS
,
EFsEditType
etype
)
{
int32_t
tsdbFileSystemEditAbort
(
struct
STFileSystem
*
pFS
,
tsdb_fs_edit_t
etype
)
{
int32_t
code
=
abort_edit
(
pFS
,
etype
);
int32_t
code
=
abort_edit
(
pFS
,
etype
);
tsem_post
(
&
pFS
->
canEdit
);
_exit:
if
(
code
)
{
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed since %s, etype:%d"
,
//
tsdbError
(
"vgId:%d %s failed since %s, etype:%d"
,
//
TD_VID
(
pFS
->
pTsdb
->
pVnode
),
//
TD_VID
(
pFS
->
pTsdb
->
pVnode
),
//
__func__
,
//
__func__
,
//
tstrerror
(
code
),
//
tstrerror
(
code
),
//
etype
);
etype
);
}
else
{
}
}
tsem_post
(
&
pFS
->
can_edit
);
return
code
;
return
code
;
}
}
\ No newline at end of file
source/dnode/vnode/src/tsdb/dev/tsdbFS.h
浏览文件 @
a0039fe2
...
@@ -23,29 +23,30 @@ extern "C" {
...
@@ -23,29 +23,30 @@ extern "C" {
#endif
#endif
/* Exposed Handle */
/* Exposed Handle */
struct
STFileSystem
;
struct
STFileSystem
{
STsdb
*
pTsdb
;
tsem_t
can_edit
;
int64_t
eidt_id
;
SArray
*
aFileSet
;
// SArray<struct SFileSet>
};
typedef
enum
{
typedef
enum
{
TSDB_FS_EDIT_COMMIT
=
0
,
TSDB_FS_EDIT_NONE
=
0
,
TSDB_FS_EDIT_COMMIT
,
TSDB_FS_EDIT_MERGE
,
TSDB_FS_EDIT_MERGE
,
}
EFsEditType
;
TSDB_FS_EDIT_MAX
,
}
tsdb_fs_edit_t
;
/* Exposed APIs */
/* Exposed APIs */
// open/close
// open/close
int32_t
tsdbOpenFileSystem
(
STsdb
*
pTsdb
,
struct
STFileSystem
**
ppFS
,
int8_t
rollback
);
int32_t
tsdbOpenFileSystem
(
STsdb
*
pTsdb
,
struct
STFileSystem
**
ppFS
,
int8_t
rollback
);
int32_t
tsdbCloseFileSystem
(
struct
STFileSystem
**
ppFS
);
int32_t
tsdbCloseFileSystem
(
struct
STFileSystem
**
ppFS
);
// txn
// txn
int32_t
tsdbFileSystemEditBegin
(
struct
STFileSystem
*
pFS
,
const
SArray
*
aFileOp
,
EFsEditType
etype
);
int32_t
tsdbFileSystemEditBegin
(
struct
STFileSystem
*
pFS
,
const
SArray
*
aFileOp
,
tsdb_fs_edit_t
etype
);
int32_t
tsdbFileSystemEditCommit
(
struct
STFileSystem
*
pFS
,
EFsEditType
etype
);
int32_t
tsdbFileSystemEditCommit
(
struct
STFileSystem
*
pFS
,
tsdb_fs_edit_t
etype
);
int32_t
tsdbFileSystemEditAbort
(
struct
STFileSystem
*
pFS
,
EFsEditType
etype
);
int32_t
tsdbFileSystemEditAbort
(
struct
STFileSystem
*
pFS
,
tsdb_fs_edit_t
etype
);
/* Exposed Structs */
/* Exposed Structs */
struct
STFileSystem
{
STsdb
*
pTsdb
;
tsem_t
canEdit
;
SArray
*
aFileSet
;
// SArray<struct SFileSet>
};
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录