Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
68f07c4b
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看板
提交
68f07c4b
编写于
5月 15, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
23ad5400
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
44 addition
and
43 deletion
+44
-43
source/dnode/vnode/src/tsdb/dev/inc/tsdbFS.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbFS.h
+4
-4
source/dnode/vnode/src/tsdb/dev/inc/tsdbFSet.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbFSet.h
+3
-3
source/dnode/vnode/src/tsdb/dev/inc/tsdbFile.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbFile.h
+7
-4
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
+26
-28
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
+2
-2
source/dnode/vnode/src/tsdb/dev/tsdbFile.c
source/dnode/vnode/src/tsdb/dev/tsdbFile.c
+2
-2
未找到文件。
source/dnode/vnode/src/tsdb/dev/inc/tsdbFS.h
浏览文件 @
68f07c4b
...
...
@@ -32,8 +32,8 @@ typedef enum {
/* Exposed APIs */
// open/close
int32_t
tsdbOpenFS
(
STsdb
*
pTsdb
,
STFileSystem
**
ppFS
,
int8_t
rollback
);
int32_t
tsdbCloseFS
(
STFileSystem
**
ppFS
);
int32_t
tsdbOpenFS
(
STsdb
*
pTsdb
,
STFileSystem
**
fs
,
int8_t
rollback
);
int32_t
tsdbCloseFS
(
STFileSystem
**
fs
);
// txn
int32_t
tsdbFSAllocEid
(
STFileSystem
*
pFS
,
int64_t
*
eid
);
int32_t
tsdbFSEditBegin
(
STFileSystem
*
fs
,
int64_t
eid
,
const
SArray
*
aFileOp
,
EFEditT
etype
);
...
...
@@ -45,14 +45,14 @@ int32_t tsdbFSGetFSet(STFileSystem *fs, int32_t fid, const STFileSet **ppFSet);
/* Exposed Structs */
struct
STFileSystem
{
STsdb
*
pTsdb
;
int32_t
state
;
tsem_t
canEdit
;
int32_t
state
;
int64_t
neid
;
SArray
*
cstate
;
// current state, SArray<STFileSet>
// new state
EFEditT
etype
;
int64_t
eid
;
SArray
*
nstate
;
//
next
state, SArray<STFileSet>
SArray
*
nstate
;
//
staging
state, SArray<STFileSet>
};
#ifdef __cplusplus
...
...
source/dnode/vnode/src/tsdb/dev/inc/tsdbFSet.h
浏览文件 @
68f07c4b
...
...
@@ -52,9 +52,9 @@ struct STFileOp {
typedef
struct
SSttLvl
{
SRBTreeNode
rbtn
;
int32_t
lvl
;
// level
int32_t
nstt
;
// number of .stt files on this level
S
TFile
*
fstt
;
// .stt files
int32_t
lvl
;
// level
int32_t
nstt
;
// number of .stt files on this level
S
RBTree
sttTree
;
// .stt file tree, sorted by cid
}
SSttLvl
;
struct
STFileSet
{
...
...
source/dnode/vnode/src/tsdb/dev/inc/tsdbFile.h
浏览文件 @
68f07c4b
...
...
@@ -47,12 +47,9 @@ int32_t tsdbTFileInit(STsdb *pTsdb, STFile *pFile);
int32_t
tsdbTFileClear
(
STFile
*
pFile
);
struct
STFile
{
LISTD
(
STFile
)
listNode
;
int32_t
ref
;
char
fname
[
TSDB_FILENAME_LEN
];
tsdb_ftype_t
type
;
SDiskID
did
;
SDiskID
did
;
// disk id
int32_t
fid
;
// file id
int64_t
cid
;
// commit id
int64_t
size
;
...
...
@@ -64,6 +61,12 @@ struct STFile {
};
};
struct
STFileObj
{
SRBTreeNode
rbtn
;
int32_t
ref
;
STFile
f
;
};
#ifdef __cplusplus
}
#endif
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
浏览文件 @
68f07c4b
...
...
@@ -37,36 +37,34 @@ static const char *gCurrentFname[] = {
[
TSDB_FCURRENT_M
]
=
"current.m.json"
,
};
static
int32_t
create_fs
(
STsdb
*
pTsdb
,
STFileSystem
**
ppFS
)
{
ppFS
[
0
]
=
taosMemoryCalloc
(
1
,
sizeof
(
*
ppFS
[
0
]));
if
(
ppFS
[
0
]
==
NULL
)
{
static
int32_t
create_fs
(
STsdb
*
pTsdb
,
STFileSystem
**
fs
)
{
fs
[
0
]
=
taosMemoryCalloc
(
1
,
sizeof
(
*
fs
[
0
]));
if
(
fs
[
0
]
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
fs
[
0
]
->
cstate
=
taosArrayInit
(
16
,
sizeof
(
STFileSet
));
fs
[
0
]
->
nstate
=
taosArrayInit
(
16
,
sizeof
(
STFileSet
));
if
(
fs
[
0
]
->
cstate
==
NULL
||
fs
[
0
]
->
nstate
==
NULL
)
{
taosArrayDestroy
(
fs
[
0
]
->
nstate
);
taosArrayDestroy
(
fs
[
0
]
->
cstate
);
taosMemoryFree
(
fs
[
0
]);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
ppFS
[
0
]
->
cstate
=
taosArrayInit
(
16
,
sizeof
(
STFileSet
));
ppFS
[
0
]
->
nstate
=
taosArrayInit
(
16
,
sizeof
(
STFileSet
));
if
(
ppFS
[
0
]
->
cstate
==
NULL
||
ppFS
[
0
]
->
nstate
==
NULL
)
{
taosArrayDestroy
(
ppFS
[
0
]
->
nstate
);
taosArrayDestroy
(
ppFS
[
0
]
->
cstate
);
taosMemoryFree
(
ppFS
[
0
]);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
ppFS
[
0
]
->
pTsdb
=
pTsdb
;
ppFS
[
0
]
->
state
=
TSDB_FS_STATE_NONE
;
tsem_init
(
&
ppFS
[
0
]
->
canEdit
,
0
,
1
);
ppFS
[
0
]
->
neid
=
0
;
fs
[
0
]
->
pTsdb
=
pTsdb
;
fs
[
0
]
->
state
=
TSDB_FS_STATE_NONE
;
tsem_init
(
&
fs
[
0
]
->
canEdit
,
0
,
1
);
fs
[
0
]
->
neid
=
0
;
return
0
;
}
static
int32_t
destroy_fs
(
STFileSystem
**
ppFS
)
{
if
(
ppFS
[
0
]
==
NULL
)
return
0
;
taosArrayDestroy
(
ppFS
[
0
]
->
nstate
);
taosArrayDestroy
(
ppFS
[
0
]
->
cstate
);
tsem_destroy
(
&
ppFS
[
0
]
->
canEdit
);
taosMemoryFree
(
ppFS
[
0
]);
ppFS
[
0
]
=
NULL
;
static
int32_t
destroy_fs
(
STFileSystem
**
fs
)
{
if
(
fs
[
0
]
==
NULL
)
return
0
;
taosArrayDestroy
(
fs
[
0
]
->
nstate
);
taosArrayDestroy
(
fs
[
0
]
->
cstate
);
tsem_destroy
(
&
fs
[
0
]
->
canEdit
);
taosMemoryFree
(
fs
[
0
]);
fs
[
0
]
=
NULL
;
return
0
;
}
...
...
@@ -398,7 +396,7 @@ static int32_t open_fs(STFileSystem *fs, int8_t rollback) {
code
=
scan_and_fix_fs
(
fs
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
else
{
code
=
save_fs
(
0
,
fs
->
n
state
,
fCurrent
);
code
=
save_fs
(
0
,
fs
->
c
state
,
fCurrent
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
...
...
@@ -470,20 +468,20 @@ _exit:
return
0
;
}
int32_t
tsdbOpenFS
(
STsdb
*
pTsdb
,
STFileSystem
**
ppFS
,
int8_t
rollback
)
{
int32_t
tsdbOpenFS
(
STsdb
*
pTsdb
,
STFileSystem
**
fs
,
int8_t
rollback
)
{
int32_t
code
;
int32_t
lino
;
code
=
create_fs
(
pTsdb
,
ppFS
);
code
=
create_fs
(
pTsdb
,
fs
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
open_fs
(
ppFS
[
0
],
rollback
);
code
=
open_fs
(
fs
[
0
],
rollback
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
destroy_fs
(
ppFS
);
destroy_fs
(
fs
);
}
else
{
tsdbInfo
(
"vgId:%d %s success"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
);
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
浏览文件 @
68f07c4b
...
...
@@ -47,8 +47,8 @@ static int32_t add_file(STFileSet *fset, STFile *f) {
if
(
f
->
type
==
TSDB_FTYPE_STT
)
{
SSttLvl
*
lvl
=
NULL
;
// TODO
lvl
->
nstt
++
;
lvl
->
fstt
=
f
;
//
lvl->nstt++;
//
lvl->fstt = f;
}
else
{
fset
->
farr
[
f
->
type
]
=
f
;
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFile.c
浏览文件 @
68f07c4b
...
...
@@ -193,7 +193,7 @@ int32_t tsdbTFileInit(STsdb *pTsdb, STFile *pFile) {
pFile
->
cid
,
//
g_tfile_info
[
pFile
->
type
].
suffix
);
}
pFile
->
ref
=
1
;
//
pFile->ref = 1;
return
0
;
}
...
...
@@ -235,7 +235,7 @@ int32_t tsdbTFileCreate(const STFile *pFile, STFile **f) {
*
f
[
0
]
=
*
pFile
;
f
[
0
]
->
ref
=
1
;
//
f[0]->ref = 1;
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录