Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
db17a59b
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
db17a59b
编写于
4月 13, 2021
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3079]<enhance>: use multi-level storage with vnode's wal files
上级
640062a5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
36 addition
and
3 deletion
+36
-3
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+36
-3
未找到文件。
src/vnode/src/vnodeMain.c
浏览文件 @
db17a59b
...
@@ -232,9 +232,28 @@ int32_t vnodeAlter(void *vparam, SCreateVnodeMsg *pVnodeCfg) {
...
@@ -232,9 +232,28 @@ int32_t vnodeAlter(void *vparam, SCreateVnodeMsg *pVnodeCfg) {
return
code
;
return
code
;
}
}
static
void
vnodeFindWalRootDir
(
int32_t
vgId
,
char
*
walRootDir
)
{
char
vnodeDir
[
TSDB_FILENAME_LEN
]
=
"
\0
"
;
snprintf
(
vnodeDir
,
TSDB_FILENAME_LEN
,
"/vnode/vnode%d/wal"
,
vgId
);
TDIR
*
tdir
=
tfsOpendir
(
vnodeDir
);
if
(
!
tdir
)
return
;
const
TFILE
*
tfile
=
tfsReaddir
(
tdir
);
if
(
!
tfile
)
{
tfsClosedir
(
tdir
);
return
;
}
sprintf
(
walRootDir
,
"%s/vnode/vnode%d"
,
TFS_DISK_PATH
(
tfile
->
level
,
tfile
->
id
),
vgId
);
tfsClosedir
(
tdir
);
}
int32_t
vnodeOpen
(
int32_t
vgId
)
{
int32_t
vnodeOpen
(
int32_t
vgId
)
{
char
temp
[
TSDB_FILENAME_LEN
*
3
];
char
temp
[
TSDB_FILENAME_LEN
*
3
];
char
rootDir
[
TSDB_FILENAME_LEN
*
2
];
char
rootDir
[
TSDB_FILENAME_LEN
*
2
];
char
walRootDir
[
TSDB_FILENAME_LEN
*
2
]
=
{
0
};
snprintf
(
rootDir
,
TSDB_FILENAME_LEN
*
2
,
"%s/vnode%d"
,
tsVnodeDir
,
vgId
);
snprintf
(
rootDir
,
TSDB_FILENAME_LEN
*
2
,
"%s/vnode%d"
,
tsVnodeDir
,
vgId
);
SVnodeObj
*
pVnode
=
calloc
(
sizeof
(
SVnodeObj
),
1
);
SVnodeObj
*
pVnode
=
calloc
(
sizeof
(
SVnodeObj
),
1
);
...
@@ -321,7 +340,21 @@ int32_t vnodeOpen(int32_t vgId) {
...
@@ -321,7 +340,21 @@ int32_t vnodeOpen(int32_t vgId) {
}
}
}
}
sprintf
(
temp
,
"%s/wal"
,
rootDir
);
// walRootDir for wal & syncInfo.path (not empty dir of /vnode/vnode{pVnode->vgId}/wal)
vnodeFindWalRootDir
(
pVnode
->
vgId
,
walRootDir
);
if
(
walRootDir
[
0
]
==
0
)
{
int
level
=
-
1
,
id
=
-
1
;
tfsAllocDisk
(
TFS_PRIMARY_LEVEL
,
&
level
,
&
id
);
if
(
level
<
0
||
id
<
0
)
{
vnodeCleanUp
(
pVnode
);
return
terrno
;
}
sprintf
(
walRootDir
,
"%s/vnode/vnode%d"
,
TFS_DISK_PATH
(
level
,
id
),
vgId
);
}
sprintf
(
temp
,
"%s/wal"
,
walRootDir
);
pVnode
->
walCfg
.
vgId
=
pVnode
->
vgId
;
pVnode
->
walCfg
.
vgId
=
pVnode
->
vgId
;
pVnode
->
wal
=
walOpen
(
temp
,
&
pVnode
->
walCfg
);
pVnode
->
wal
=
walOpen
(
temp
,
&
pVnode
->
walCfg
);
if
(
pVnode
->
wal
==
NULL
)
{
if
(
pVnode
->
wal
==
NULL
)
{
...
@@ -353,7 +386,7 @@ int32_t vnodeOpen(int32_t vgId) {
...
@@ -353,7 +386,7 @@ int32_t vnodeOpen(int32_t vgId) {
pVnode
->
events
=
NULL
;
pVnode
->
events
=
NULL
;
vDebug
(
"vgId:%d, vnode is opened in %s
, pVnode:%p"
,
pVnode
->
vgId
,
r
ootDir
,
pVnode
);
vDebug
(
"vgId:%d, vnode is opened in %s
- %s, pVnode:%p"
,
pVnode
->
vgId
,
rootDir
,
walR
ootDir
,
pVnode
);
vnodeAddIntoHash
(
pVnode
);
vnodeAddIntoHash
(
pVnode
);
...
@@ -361,7 +394,7 @@ int32_t vnodeOpen(int32_t vgId) {
...
@@ -361,7 +394,7 @@ int32_t vnodeOpen(int32_t vgId) {
syncInfo
.
vgId
=
pVnode
->
vgId
;
syncInfo
.
vgId
=
pVnode
->
vgId
;
syncInfo
.
version
=
pVnode
->
version
;
syncInfo
.
version
=
pVnode
->
version
;
syncInfo
.
syncCfg
=
pVnode
->
syncCfg
;
syncInfo
.
syncCfg
=
pVnode
->
syncCfg
;
tstrncpy
(
syncInfo
.
path
,
r
ootDir
,
TSDB_FILENAME_LEN
);
tstrncpy
(
syncInfo
.
path
,
walR
ootDir
,
TSDB_FILENAME_LEN
);
syncInfo
.
getWalInfoFp
=
vnodeGetWalInfo
;
syncInfo
.
getWalInfoFp
=
vnodeGetWalInfo
;
syncInfo
.
writeToCacheFp
=
vnodeWriteToCache
;
syncInfo
.
writeToCacheFp
=
vnodeWriteToCache
;
syncInfo
.
confirmForward
=
vnodeConfirmForard
;
syncInfo
.
confirmForward
=
vnodeConfirmForard
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录