Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8612f882
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看板
提交
8612f882
编写于
4月 16, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into feature/3.0_liaohj
上级
902fcb0c
5ac599b3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
58 deletion
+63
-58
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+5
-0
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+58
-58
未找到文件。
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
8612f882
...
@@ -52,6 +52,11 @@ typedef struct SVState SVState;
...
@@ -52,6 +52,11 @@ typedef struct SVState SVState;
typedef
struct
SVBufPool
SVBufPool
;
typedef
struct
SVBufPool
SVBufPool
;
typedef
struct
SQWorkerMgmt
SQHandle
;
typedef
struct
SQWorkerMgmt
SQHandle
;
#define VNODE_META_DIR "meta"
#define VNODE_TSDB_DIR "tsdb"
#define VNODE_TQ_DIR "tq"
#define VNODE_WAL_DIR "wal"
typedef
struct
{
typedef
struct
{
int8_t
streamType
;
// sma or other
int8_t
streamType
;
// sma or other
int8_t
dstType
;
int8_t
dstType
;
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
8612f882
...
@@ -15,9 +15,6 @@
...
@@ -15,9 +15,6 @@
#include "vnodeInt.h"
#include "vnodeInt.h"
static
int
vnodeOpenImpl
(
SVnode
*
pVnode
);
static
void
vnodeCloseImpl
(
SVnode
*
pVnode
);
int
vnodeCreate
(
const
char
*
path
,
SVnodeCfg
*
pCfg
,
STfs
*
pTfs
)
{
int
vnodeCreate
(
const
char
*
path
,
SVnodeCfg
*
pCfg
,
STfs
*
pTfs
)
{
SVnodeInfo
info
=
{
0
};
SVnodeInfo
info
=
{
0
};
char
dir
[
TSDB_FILENAME_LEN
];
char
dir
[
TSDB_FILENAME_LEN
];
...
@@ -55,6 +52,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
...
@@ -55,6 +52,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
SVnode
*
pVnode
=
NULL
;
SVnode
*
pVnode
=
NULL
;
SVnodeInfo
info
=
{
0
};
SVnodeInfo
info
=
{
0
};
char
dir
[
TSDB_FILENAME_LEN
];
char
dir
[
TSDB_FILENAME_LEN
];
char
tdir
[
TSDB_FILENAME_LEN
*
2
];
int
ret
;
int
ret
;
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pTfs
),
TD_DIRSEP
,
path
);
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pTfs
),
TD_DIRSEP
,
path
);
...
@@ -83,83 +81,85 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
...
@@ -83,83 +81,85 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
tsem_init
(
&
(
pVnode
->
canCommit
),
0
,
1
);
tsem_init
(
&
(
pVnode
->
canCommit
),
0
,
1
);
// open the vnode
// open buffer pool
if
(
vnodeOpenImpl
(
pVnode
)
<
0
)
{
// TODO: handle error
return
NULL
;
}
return
pVnode
;
}
void
vnodeClose
(
SVnode
*
pVnode
)
{
if
(
pVnode
)
{
vnodeCloseImpl
(
pVnode
);
tsem_destroy
(
&
(
pVnode
->
canCommit
));
taosMemoryFreeClear
(
pVnode
->
path
);
taosMemoryFree
(
pVnode
);
}
}
/* ------------------------ STATIC METHODS ------------------------ */
static
int
vnodeOpenImpl
(
SVnode
*
pVnode
)
{
char
dir
[
TSDB_FILENAME_LEN
];
if
(
vnodeOpenBufPool
(
pVnode
)
<
0
)
{
if
(
vnodeOpenBufPool
(
pVnode
)
<
0
)
{
// TODO: handle error
vError
(
"vgId: %d failed to open vnode buffer pool since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
return
-
1
;
goto
_err
;
}
}
//
O
pen meta
//
o
pen meta
sprintf
(
dir
,
"%s/meta"
,
pVnode
->
path
);
sprintf
(
tdir
,
"%s%s%s"
,
dir
,
TD_DIRSEP
,
VNODE_META_DIR
);
pVnode
->
pMeta
=
metaOpen
(
dir
,
vBufPoolGetMAF
(
pVnode
));
pVnode
->
pMeta
=
metaOpen
(
t
dir
,
vBufPoolGetMAF
(
pVnode
));
if
(
pVnode
->
pMeta
==
NULL
)
{
if
(
pVnode
->
pMeta
==
NULL
)
{
// TODO: handle error
vError
(
"vgId: %d failed to open vnode meta since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
return
-
1
;
goto
_err
;
}
}
//
O
pen tsdb
//
o
pen tsdb
sprintf
(
dir
,
"%s/tsdb"
,
pVnode
->
path
);
sprintf
(
tdir
,
"%s%s%s"
,
dir
,
TD_DIRSEP
,
VNODE_TSDB_DIR
);
pVnode
->
pTsdb
=
pVnode
->
pTsdb
=
tsdbOpen
(
dir
,
TD_VID
(
pVnode
),
&
(
pVnode
->
config
.
tsdbCfg
),
vBufPoolGetMAF
(
pVnode
),
pVnode
->
pMeta
,
pVnode
->
pTfs
);
tsdbOpen
(
t
dir
,
TD_VID
(
pVnode
),
&
(
pVnode
->
config
.
tsdbCfg
),
vBufPoolGetMAF
(
pVnode
),
pVnode
->
pMeta
,
pVnode
->
pTfs
);
if
(
pVnode
->
pTsdb
==
NULL
)
{
if
(
pVnode
->
pTsdb
==
NULL
)
{
// TODO: handle error
vError
(
"vgId: %d failed to open vnode tsdb since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
return
-
1
;
goto
_err
;
}
}
//
Open WAL
//
open wal
sprintf
(
dir
,
"%s/wal"
,
pVnode
->
path
);
sprintf
(
tdir
,
"%s%s%s"
,
dir
,
TD_DIRSEP
,
VNODE_WAL_DIR
);
pVnode
->
pWal
=
walOpen
(
dir
,
&
(
pVnode
->
config
.
walCfg
));
pVnode
->
pWal
=
walOpen
(
t
dir
,
&
(
pVnode
->
config
.
walCfg
));
if
(
pVnode
->
pWal
==
NULL
)
{
if
(
pVnode
->
pWal
==
NULL
)
{
// TODO: handle error
vError
(
"vgId: %d failed to open vnode wal since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
return
-
1
;
goto
_err
;
}
}
//
Open TQ
//
open tq
sprintf
(
dir
,
"%s/tq"
,
pVnode
->
path
);
sprintf
(
tdir
,
"%s%s%s"
,
dir
,
TD_DIRSEP
,
VNODE_TQ_DIR
);
pVnode
->
pTq
=
tqOpen
(
dir
,
pVnode
,
pVnode
->
pWal
,
pVnode
->
pMeta
,
vBufPoolGetMAF
(
pVnode
));
pVnode
->
pTq
=
tqOpen
(
t
dir
,
pVnode
,
pVnode
->
pWal
,
pVnode
->
pMeta
,
vBufPoolGetMAF
(
pVnode
));
if
(
pVnode
->
pTq
==
NULL
)
{
if
(
pVnode
->
pTq
==
NULL
)
{
// TODO: handle error
vError
(
"vgId: %d failed to open vnode tq since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
return
-
1
;
goto
_err
;
}
}
//
Open Q
uery
//
open q
uery
if
(
vnodeQueryOpen
(
pVnode
))
{
if
(
vnodeQueryOpen
(
pVnode
))
{
return
-
1
;
vError
(
"vgId: %d failed to open vnode query since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
}
}
// TODO
#if 0
return
0
;
if (vnodeBegin() < 0) {
goto _err;
}
#endif
return
pVnode
;
_err:
if
(
pVnode
->
pQuery
)
vnodeQueryClose
(
pVnode
);
if
(
pVnode
->
pTq
)
tqClose
(
pVnode
->
pTq
);
if
(
pVnode
->
pWal
)
walClose
(
pVnode
->
pWal
);
if
(
pVnode
->
pTsdb
)
tsdbClose
(
pVnode
->
pTsdb
);
if
(
pVnode
->
pMeta
)
metaClose
(
pVnode
->
pMeta
);
tsem_destroy
(
&
(
pVnode
->
canCommit
));
taosMemoryFreeClear
(
pVnode
->
path
);
taosMemoryFree
(
pVnode
);
return
NULL
;
}
}
static
void
vnodeCloseImpl
(
SVnode
*
pVnode
)
{
void
vnodeClose
(
SVnode
*
pVnode
)
{
vnodeSyncCommit
(
pVnode
);
if
(
pVnode
)
{
if
(
pVnode
)
{
vnodeCloseBufPool
(
pVnode
);
// commit (TODO: use option to control)
metaClose
(
pVnode
->
pMeta
);
vnodeSyncCommit
(
pVnode
);
tsdbClose
(
pVnode
->
pTsdb
);
// close vnode
tqClose
(
pVnode
->
pTq
);
walClose
(
pVnode
->
pWal
);
vnodeQueryClose
(
pVnode
);
vnodeQueryClose
(
pVnode
);
walClose
(
pVnode
->
pWal
);
tqClose
(
pVnode
->
pTq
);
tsdbClose
(
pVnode
->
pTsdb
);
metaClose
(
pVnode
->
pMeta
);
vnodeCloseBufPool
(
pVnode
);
// destroy handle
tsem_destroy
(
&
(
pVnode
->
canCommit
));
taosMemoryFreeClear
(
pVnode
->
path
);
taosMemoryFree
(
pVnode
);
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录