Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6e7ab6ca
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6e7ab6ca
编写于
4月 16, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact vnode
上级
fe368d0f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
41 deletion
+19
-41
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+0
-2
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+2
-2
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+17
-37
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
6e7ab6ca
...
...
@@ -135,7 +135,6 @@ struct STsdbCfg {
struct
SVnodeCfg
{
int32_t
vgId
;
uint64_t
dbId
;
STfs
*
pTfs
;
uint64_t
wsize
;
uint64_t
ssize
;
uint64_t
lsize
;
...
...
@@ -146,7 +145,6 @@ struct SVnodeCfg {
bool
isWeak
;
STsdbCfg
tsdbCfg
;
SWalCfg
walCfg
;
SMsgCb
msgCb
;
uint32_t
hashBegin
;
uint32_t
hashEnd
;
int8_t
hashMethod
;
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
6e7ab6ca
...
...
@@ -83,6 +83,8 @@ struct SVnode {
char
*
path
;
SVnodeCfg
config
;
SVState
state
;
STfs
*
pTfs
;
SMsgCb
msgCb
;
SVBufPool
*
pBufPool
;
SMeta
*
pMeta
;
STsdb
*
pTsdb
;
...
...
@@ -91,8 +93,6 @@ struct SVnode {
SSink
*
pSink
;
tsem_t
canCommit
;
SQHandle
*
pQuery
;
SMsgCb
msgCb
;
STfs
*
pTfs
;
};
#define TD_VID(PVNODE) (PVNODE)->config.vgId
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
6e7ab6ca
...
...
@@ -15,10 +15,8 @@
#include "vnodeInt.h"
static
SVnode
*
vnodeNew
(
const
char
*
path
,
const
SVnodeCfg
*
pVnodeCfg
);
static
void
vnodeFree
(
SVnode
*
pVnode
);
static
int
vnodeOpenImpl
(
SVnode
*
pVnode
);
static
void
vnodeCloseImpl
(
SVnode
*
pVnode
);
static
int
vnodeOpenImpl
(
SVnode
*
pVnode
);
static
void
vnodeCloseImpl
(
SVnode
*
pVnode
);
int
vnodeCreate
(
const
char
*
path
,
SVnodeCfg
*
pCfg
,
STfs
*
pTfs
)
{
SVnodeInfo
info
=
{
0
};
...
...
@@ -68,17 +66,24 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
return
NULL
;
}
info
.
config
.
pTfs
=
pTfs
;
info
.
config
.
msgCb
=
msgCb
;
// crate handle
pVnode
=
vnodeNew
(
dir
,
&
info
.
config
);
// create handle
pVnode
=
(
SVnode
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pVnode
));
if
(
pVnode
==
NULL
)
{
// TODO: handle error
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
vError
(
"vgId: %d failed to open vnode since %s"
,
info
.
config
.
vgId
,
tstrerror
(
terrno
));
return
NULL
;
}
// Open the vnode
pVnode
->
path
=
strdup
(
dir
);
pVnode
->
config
=
info
.
config
;
pVnode
->
state
.
committed
=
info
.
state
.
committed
;
pVnode
->
state
.
processed
=
pVnode
->
state
.
applied
=
pVnode
->
state
.
committed
;
pVnode
->
pTfs
=
pTfs
;
pVnode
->
msgCb
=
msgCb
;
tsem_init
(
&
(
pVnode
->
canCommit
),
0
,
1
);
// open the vnode
if
(
vnodeOpenImpl
(
pVnode
)
<
0
)
{
// TODO: handle error
return
NULL
;
...
...
@@ -90,38 +95,13 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
void
vnodeClose
(
SVnode
*
pVnode
)
{
if
(
pVnode
)
{
vnodeCloseImpl
(
pVnode
);
vnodeFree
(
pVnode
);
}
}
/* ------------------------ STATIC METHODS ------------------------ */
static
SVnode
*
vnodeNew
(
const
char
*
path
,
const
SVnodeCfg
*
pVnodeCfg
)
{
SVnode
*
pVnode
=
NULL
;
pVnode
=
(
SVnode
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pVnode
));
if
(
pVnode
==
NULL
)
{
// TODO
return
NULL
;
}
pVnode
->
msgCb
=
pVnodeCfg
->
msgCb
;
pVnode
->
pTfs
=
pVnodeCfg
->
pTfs
;
pVnode
->
path
=
strdup
(
path
);
vnodeOptionsCopy
(
&
(
pVnode
->
config
),
pVnodeCfg
);
tsem_init
(
&
(
pVnode
->
canCommit
),
0
,
1
);
return
pVnode
;
}
static
void
vnodeFree
(
SVnode
*
pVnode
)
{
if
(
pVnode
)
{
tsem_destroy
(
&
(
pVnode
->
canCommit
));
taosMemoryFreeClear
(
pVnode
->
path
);
taosMemoryFree
(
pVnode
);
}
}
/* ------------------------ STATIC METHODS ------------------------ */
static
int
vnodeOpenImpl
(
SVnode
*
pVnode
)
{
char
dir
[
TSDB_FILENAME_LEN
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录