Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzh_me
TDengine
提交
b9c08aff
TDengine
项目概览
lzh_me
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b9c08aff
编写于
5月 23, 2020
作者:
陶建辉(Jeff)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make more changes on vnodeMain.c
上级
2a4feceb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
31 deletion
+15
-31
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+15
-31
未找到文件。
src/vnode/src/vnodeMain.c
浏览文件 @
b9c08aff
...
...
@@ -148,35 +148,20 @@ int32_t vnodeAlter(void *param, SMDCreateVnodeMsg *pVnodeCfg) {
pVnode
->
status
=
TAOS_VN_STATUS_UPDATING
;
int32_t
code
=
vnodeSaveCfg
(
pVnodeCfg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d, failed to save vnode cfg, reason:%s"
,
pVnodeCfg
->
cfg
.
vgId
,
tstrerror
(
code
));
return
code
;
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
return
code
;
code
=
vnodeReadCfg
(
pVnode
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d, failed to read cfg file"
,
pVnode
->
vgId
);
taosHashRemove
(
tsDnodeVnodesHash
,
(
const
char
*
)
&
pVnode
->
vgId
,
sizeof
(
int32_t
));
return
code
;
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
return
code
;
code
=
syncReconfig
(
pVnode
->
sync
,
&
pVnode
->
syncCfg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
vTrace
(
"vgId:%d, failed to alter vnode, canot reconfig sync, result:%s"
,
pVnode
->
vgId
,
tstrerror
(
code
));
return
code
;
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
return
code
;
code
=
tsdbConfigRepo
(
pVnode
->
tsdb
,
&
pVnode
->
tsdbCfg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
vTrace
(
"vgId:%d, failed to alter vnode, canot reconfig tsdb, result:%s"
,
pVnode
->
vgId
,
tstrerror
(
code
));
return
code
;
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
return
code
;
pVnode
->
status
=
TAOS_VN_STATUS_READY
;
vTrace
(
"vgId:%d, vnode is altered"
,
pVnode
->
vgId
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -491,7 +476,8 @@ static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) {
if
(
!
fp
)
{
vError
(
"vgId:%d, failed to open vnode cfg file for write, file:%s error:%s"
,
pVnodeCfg
->
cfg
.
vgId
,
cfgFile
,
strerror
(
errno
));
return
errno
;
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
terrno
;
}
int32_t
len
=
0
;
...
...
@@ -545,7 +531,6 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) {
char
*
content
=
NULL
;
char
cfgFile
[
TSDB_FILENAME_LEN
+
30
]
=
{
0
};
int
maxLen
=
1000
;
int32_t
code
=
TSDB_CODE_OTHERS
;
terrno
=
TSDB_CODE_OTHERS
;
sprintf
(
cfgFile
,
"%s/vnode%d/config.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
...
...
@@ -553,7 +538,7 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) {
if
(
!
fp
)
{
vError
(
"vgId:%d, failed to open vnode cfg file:%s to read, error:%s"
,
pVnode
->
vgId
,
cfgFile
,
strerror
(
errno
));
code
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
PARSE_OVER
;
}
...
...
@@ -724,7 +709,7 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) {
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodePort
+=
TSDB_PORT_SYNC
;
}
code
=
TSDB_CODE_SUCCESS
;
terrno
=
TSDB_CODE_SUCCESS
;
vPrint
(
"vgId:%d, read vnode cfg successfully, replcia:%d"
,
pVnode
->
vgId
,
pVnode
->
syncCfg
.
replica
);
for
(
int32_t
i
=
0
;
i
<
pVnode
->
syncCfg
.
replica
;
i
++
)
{
...
...
@@ -736,7 +721,7 @@ PARSE_OVER:
tfree
(
content
);
cJSON_Delete
(
root
);
if
(
fp
)
fclose
(
fp
);
return
code
;
return
terrno
;
}
static
int32_t
vnodeSaveVersion
(
SVnodeObj
*
pVnode
)
{
...
...
@@ -771,16 +756,16 @@ static int32_t vnodeReadVersion(SVnodeObj *pVnode) {
char
*
content
=
NULL
;
cJSON
*
root
=
NULL
;
int
maxLen
=
100
;
int32_t
code
=
TSDB_CODE_OTHERS
;
terrno
=
TSDB_CODE_OTHERS
;
sprintf
(
versionFile
,
"%s/vnode%d/version.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
FILE
*
fp
=
fopen
(
versionFile
,
"r"
);
if
(
!
fp
)
{
if
(
errno
!=
ENOENT
)
{
vError
(
"vgId:%d, failed to open version file:%s error:%s"
,
pVnode
->
vgId
,
versionFile
,
strerror
(
errno
));
code
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
}
else
{
code
=
TSDB_CODE_SUCCESS
;
terrno
=
TSDB_CODE_SUCCESS
;
}
goto
PARSE_OVER
;
}
...
...
@@ -805,13 +790,12 @@ static int32_t vnodeReadVersion(SVnodeObj *pVnode) {
}
pVnode
->
version
=
version
->
valueint
;
code
=
TSDB_CODE_SUCCESS
;
terrno
=
TSDB_CODE_SUCCESS
;
vPrint
(
"vgId:%d, read vnode version successfully, version:%"
PRId64
,
pVnode
->
vgId
,
pVnode
->
version
);
PARSE_OVER:
tfree
(
content
);
cJSON_Delete
(
root
);
if
(
fp
)
fclose
(
fp
);
return
code
;
return
terrno
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录