Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
3c8d8bc4
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3c8d8bc4
编写于
4月 08, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix read file error
上级
029391f0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
15 deletion
+15
-15
src/vnode/main/src/vnodeMain.c
src/vnode/main/src/vnodeMain.c
+15
-15
未找到文件。
src/vnode/main/src/vnodeMain.c
浏览文件 @
3c8d8bc4
...
...
@@ -317,51 +317,51 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) {
FILE
*
fp
=
fopen
(
cfgFile
,
"r"
);
if
(
!
fp
)
return
errno
;
int32_t
commitLog
=
0
;
int32_t
commitLog
=
-
1
;
int32_t
num
=
fscanf
(
fp
,
"%s %d"
,
option
[
0
],
&
commitLog
);
if
(
num
!=
2
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
strcmp
(
option
[
0
],
"commitLog"
)
!=
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
commitLog
==
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
commitLog
==
-
1
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
pVnode
->
walCfg
.
commitLog
=
(
int8_t
)
commitLog
;
int32_t
wals
=
0
;
int32_t
wals
=
-
1
;
num
=
fscanf
(
fp
,
"%s %d"
,
option
[
0
],
&
wals
);
if
(
num
!=
2
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
strcmp
(
option
[
0
],
"wals"
)
!=
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
wals
==
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
wals
==
-
1
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
pVnode
->
walCfg
.
wals
=
(
int8_t
)
wals
;
int32_t
arbitratorIp
=
0
;
int32_t
arbitratorIp
=
-
1
;
num
=
fscanf
(
fp
,
"%s %u"
,
option
[
0
],
&
arbitratorIp
);
if
(
num
!=
2
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
strcmp
(
option
[
0
],
"arbitratorIp"
)
!=
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
arbitratorIp
==
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
arbitratorIp
==
-
1
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
pVnode
->
syncCfg
.
arbitratorIp
=
arbitratorIp
;
int32_t
quorum
=
0
;
int32_t
quorum
=
-
1
;
num
=
fscanf
(
fp
,
"%s %d"
,
option
[
0
],
&
quorum
);
if
(
num
!=
2
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
strcmp
(
option
[
0
],
"quorum"
)
!=
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
quorum
==
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
quorum
==
-
1
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
pVnode
->
syncCfg
.
quorum
=
(
int8_t
)
quorum
;
int32_t
replica
=
0
;
int32_t
replica
=
-
1
;
num
=
fscanf
(
fp
,
"%s %d"
,
option
[
0
],
&
replica
);
if
(
num
!=
2
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
strcmp
(
option
[
0
],
"replica"
)
!=
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
replica
==
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
replica
==
-
1
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
pVnode
->
syncCfg
.
replica
=
(
int8_t
)
replica
;
for
(
int32_t
i
=
0
;
i
<
replica
;
++
i
)
{
int32_t
dnodeId
=
0
;
uint32_t
dnodeIp
=
0
;
int32_t
dnodeId
=
-
1
;
uint32_t
dnodeIp
=
-
1
;
num
=
fscanf
(
fp
,
"%s %s %d %s %u %s %s"
,
option
[
0
],
option
[
1
],
&
dnodeId
,
option
[
2
],
&
dnodeIp
,
option
[
3
],
pVnode
->
syncCfg
.
nodeInfo
[
i
].
name
);
if
(
num
!=
7
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
strcmp
(
option
[
1
],
"nodeId"
)
!=
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
strcmp
(
option
[
2
],
"nodeIp"
)
!=
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
strcmp
(
option
[
3
],
"name"
)
!=
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
dnodeId
==
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
dnodeIp
==
0
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
dnodeId
==
-
1
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
if
(
dnodeIp
==
-
1
)
return
TSDB_CODE_INVALID_FILE_FORMAT
;
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodeId
=
dnodeId
;
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodeIp
=
dnodeIp
;
}
...
...
@@ -370,4 +370,4 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) {
dTrace
(
"pVnode:%p vgId:%d, read vnode cfg successed"
,
pVnode
,
pVnode
->
vgId
);
return
TSDB_CODE_SUCCESS
;
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录