Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9f2078ae
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9f2078ae
编写于
1月 31, 2023
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: rename tsdb file
上级
5d8f0574
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
47 addition
and
2 deletion
+47
-2
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+1
-1
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+46
-1
未找到文件。
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
9f2078ae
...
@@ -342,7 +342,7 @@ int32_t vmProcessAlterHashRangeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -342,7 +342,7 @@ int32_t vmProcessAlterHashRangeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return
-
1
;
return
-
1
;
}
}
dInfo
(
"vgId:%d, open vnode"
,
dstVgId
);
dInfo
(
"vgId:%d,
start to
open vnode"
,
dstVgId
);
SVnode
*
pImpl
=
vnodeOpen
(
dstPath
,
pMgmt
->
pTfs
,
pMgmt
->
msgCb
);
SVnode
*
pImpl
=
vnodeOpen
(
dstPath
,
pMgmt
->
pTfs
,
pMgmt
->
msgCb
);
if
(
pImpl
==
NULL
)
{
if
(
pImpl
==
NULL
)
{
dError
(
"vgId:%d, failed to open vnode at %s since %s"
,
dstVgId
,
dstPath
,
terrstr
());
dError
(
"vgId:%d, failed to open vnode at %s since %s"
,
dstVgId
,
dstPath
,
terrstr
());
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
9f2078ae
...
@@ -107,6 +107,51 @@ int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, STfs *p
...
@@ -107,6 +107,51 @@ int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, STfs *p
return
0
;
return
0
;
}
}
int32_t
vnodeRenameVgroupId
(
const
char
*
srcPath
,
const
char
*
dstPath
,
int32_t
srcVgId
,
int32_t
dstVgId
,
STfs
*
pTfs
)
{
int32_t
ret
=
tfsRename
(
pTfs
,
srcPath
,
dstPath
);
if
(
ret
!=
0
)
return
ret
;
char
oldRname
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
newRname
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsdbPath
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
tsdbFilePrefix
[
TSDB_FILENAME_LEN
]
=
{
0
};
snprintf
(
tsdbPath
,
TSDB_FILENAME_LEN
,
"%s%stsdb"
,
dstPath
,
TD_DIRSEP
);
snprintf
(
tsdbFilePrefix
,
TSDB_FILENAME_LEN
,
"tsdb%sv"
,
TD_DIRSEP
);
STfsDir
*
tsdbDir
=
tfsOpendir
(
pTfs
,
tsdbPath
);
if
(
tsdbDir
==
NULL
)
return
0
;
while
(
1
)
{
const
STfsFile
*
tsdbFile
=
tfsReaddir
(
tsdbDir
);
if
(
tsdbFile
==
NULL
)
break
;
if
(
tsdbFile
->
rname
==
NULL
)
continue
;
tstrncpy
(
oldRname
,
tsdbFile
->
rname
,
TSDB_FILENAME_LEN
);
char
*
tsdbFilePrefixPos
=
strstr
(
oldRname
,
tsdbFilePrefix
);
if
(
tsdbFilePrefixPos
==
NULL
)
continue
;
int32_t
tsdbFileVgId
=
atoi
(
tsdbFilePrefixPos
+
6
);
if
(
tsdbFileVgId
==
srcVgId
)
{
char
*
tsdbFileSurfixPos
=
strstr
(
tsdbFilePrefixPos
,
"f"
);
if
(
tsdbFileSurfixPos
==
NULL
)
continue
;
tsdbFilePrefixPos
[
6
]
=
0
;
snprintf
(
newRname
,
TSDB_FILENAME_LEN
,
"%s%d%s"
,
oldRname
,
dstVgId
,
tsdbFileSurfixPos
);
vInfo
(
"vgId:%d, rename file from %s to %s"
,
dstVgId
,
tsdbFile
->
rname
,
newRname
);
ret
=
tfsRename
(
pTfs
,
tsdbFile
->
rname
,
newRname
);
if
(
ret
!=
0
)
{
vInfo
(
"vgId:%d, failed to rename file from %s to %s since %s"
,
dstVgId
,
tsdbFile
->
rname
,
newRname
,
terrstr
());
tfsClosedir
(
tsdbDir
);
return
ret
;
}
}
}
tfsClosedir
(
tsdbDir
);
return
0
;
}
int32_t
vnodeAlterHashRange
(
const
char
*
srcPath
,
const
char
*
dstPath
,
SAlterVnodeHashRangeReq
*
pReq
,
STfs
*
pTfs
)
{
int32_t
vnodeAlterHashRange
(
const
char
*
srcPath
,
const
char
*
dstPath
,
SAlterVnodeHashRangeReq
*
pReq
,
STfs
*
pTfs
)
{
SVnodeInfo
info
=
{
0
};
SVnodeInfo
info
=
{
0
};
char
dir
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
dir
[
TSDB_FILENAME_LEN
]
=
{
0
};
...
@@ -158,7 +203,7 @@ int32_t vnodeAlterHashRange(const char *srcPath, const char *dstPath, SAlterVnod
...
@@ -158,7 +203,7 @@ int32_t vnodeAlterHashRange(const char *srcPath, const char *dstPath, SAlterVnod
}
}
vInfo
(
"vgId:%d, start to rename %s to %s"
,
pReq
->
dstVgId
,
srcPath
,
dstPath
);
vInfo
(
"vgId:%d, start to rename %s to %s"
,
pReq
->
dstVgId
,
srcPath
,
dstPath
);
ret
=
tfsRename
(
pTfs
,
srcPath
,
dstPath
);
ret
=
vnodeRenameVgroupId
(
srcPath
,
dstPath
,
pReq
->
srcVgId
,
pReq
->
dstVgId
,
pTfs
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
vError
(
"vgId:%d, failed to rename vnode from %s to %s since %s"
,
pReq
->
dstVgId
,
srcPath
,
dstPath
,
vError
(
"vgId:%d, failed to rename vnode from %s to %s since %s"
,
pReq
->
dstVgId
,
srcPath
,
dstPath
,
tstrerror
(
terrno
));
tstrerror
(
terrno
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录