Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a5523872
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a5523872
编写于
10月 22, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1767
上级
eb5950b6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
23 deletion
+35
-23
src/common/src/tglobal.c
src/common/src/tglobal.c
+9
-4
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+5
-5
src/util/src/tconfig.c
src/util/src/tconfig.c
+21
-14
未找到文件。
src/common/src/tglobal.c
浏览文件 @
a5523872
...
...
@@ -321,22 +321,27 @@ void taosAddDataDir(int index, char *v1, int level, int primary) {
#ifndef _STORAGE
void
taosReadDataDirCfg
(
char
*
v1
,
char
*
v2
,
char
*
v3
)
{
taosAddDataDir
(
0
,
tsDataDir
,
0
,
1
);
tstrncpy
(
tsDiskCfg
[
0
].
dir
,
tsDataDir
,
TSDB_FILENAME_LEN
);
if
(
tsDiskCfgNum
==
1
)
{
SDiskCfg
*
cfg
=
&
tsDiskCfg
[
0
];
uInfo
(
"dataDir:%s, level:%d primary:%d is replaced by %s"
,
cfg
->
dir
,
cfg
->
level
,
cfg
->
primary
,
v1
);
}
taosAddDataDir
(
0
,
v1
,
0
,
1
);
tsDiskCfgNum
=
1
;
}
#endif
void
taosPrintDataDirCfg
()
{
for
(
int
i
=
0
;
i
<
tsDiskCfgNum
;
++
i
)
{
SDiskCfg
*
cfg
=
&
tsDiskCfg
[
i
];
uInfo
(
" dataDir:
%s level:%d primary:%d"
,
cfg
->
dir
,
cfg
->
level
,
cfg
->
primary
);
uInfo
(
" dataDir:
%s"
,
cfg
->
dir
);
}
}
#endif
static
void
taosCheckDataDirCfg
()
{
if
(
tsDiskCfgNum
<=
0
)
{
taosAddDataDir
(
0
,
tsDataDir
,
0
,
1
);
tsDiskCfgNum
=
1
;
uTrace
(
"dataDir:%s, level:0 primary:1 is configured by default"
,
tsDataDir
);
}
}
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
a5523872
...
...
@@ -104,7 +104,7 @@ int32_t dnodeInitSystem() {
signal
(
SIGPIPE
,
SIG_IGN
);
if
(
dnodeCreateDir
(
tsLogDir
)
<
0
)
{
printf
(
"failed to create dir: %s, reason: %s
\n
"
,
tsLogDir
,
strerror
(
errno
));
printf
(
"failed to create
log
dir: %s, reason: %s
\n
"
,
tsLogDir
,
strerror
(
errno
));
return
-
1
;
}
...
...
@@ -186,13 +186,13 @@ static int32_t dnodeInitStorage() {
//TODO(dengyihao): no need to init here
tdGetMnodeRootDir
(
tsDataDir
,
tsMnodeDir
);
if
(
dnodeCreateDir
(
tsMnodeDir
)
<
0
)
{
dError
(
"failed to create dir: %s, reason: %s"
,
tsMnodeDir
,
strerror
(
errno
));
dError
(
"failed to create
mnode
dir: %s, reason: %s"
,
tsMnodeDir
,
strerror
(
errno
));
return
-
1
;
}
tdGetDnodeRootDir
(
tsDataDir
,
tsDnodeDir
);
if
(
dnodeCreateDir
(
tsDnodeDir
)
<
0
)
{
dError
(
"failed to create dir: %s, reason: %s"
,
tsDnodeDir
,
strerror
(
errno
));
dError
(
"failed to create d
node d
ir: %s, reason: %s"
,
tsDnodeDir
,
strerror
(
errno
));
return
-
1
;
}
...
...
@@ -205,13 +205,13 @@ static int32_t dnodeInitStorage() {
tdGetVnodeRootDir
(
dirName
,
pDisk
->
dir
);
if
(
dnodeCreateDir
(
dirName
)
<
0
)
{
dError
(
"failed to create dir: %s, reason: %s"
,
dirName
,
strerror
(
errno
));
dError
(
"failed to create
vnode
dir: %s, reason: %s"
,
dirName
,
strerror
(
errno
));
return
-
1
;
}
tdGetVnodeBackRootDir
(
dirName
,
pDisk
->
dir
);
if
(
dnodeCreateDir
(
dirName
)
<
0
)
{
dError
(
"failed to create dir: %s, reason: %s"
,
dirName
,
strerror
(
errno
));
dError
(
"failed to create
vnode back
dir: %s, reason: %s"
,
dirName
,
strerror
(
errno
));
return
-
1
;
}
}
...
...
src/util/src/tconfig.c
浏览文件 @
a5523872
...
...
@@ -97,32 +97,34 @@ static void taosReadInt16Config(SGlobalCfg *cfg, char *input_value) {
}
}
static
void
taosReadDirectoryConfig
(
SGlobalCfg
*
cfg
,
char
*
input_value
)
{
static
bool
taosReadDirectoryConfig
(
SGlobalCfg
*
cfg
,
char
*
input_value
)
{
int
length
=
(
int
)
strlen
(
input_value
);
char
*
option
=
(
char
*
)
cfg
->
ptr
;
if
(
length
<=
0
||
length
>
cfg
->
ptrLength
)
{
uError
(
"config option:%s, input value:%s, length out of range[0, %d], use default value:%s"
,
cfg
->
option
,
input_value
,
cfg
->
ptrLength
,
option
);
uError
(
"config option:%s, input value:%s, length out of range[0, %d], use default value:%s"
,
cfg
->
option
,
input_value
,
cfg
->
ptrLength
,
option
);
return
false
;
}
else
{
if
(
cfg
->
cfgStatus
<=
TAOS_CFG_CSTATUS_FILE
)
{
wordexp_t
full_path
;
if
(
0
!=
wordexp
(
input_value
,
&
full_path
,
0
))
{
printf
(
"
\n
config dir: %s wordexp fail! reason:%s
\n
"
,
input_value
,
strerror
(
errno
));
wordfree
(
&
full_path
);
return
;
return
false
;
}
if
(
full_path
.
we_wordv
!=
NULL
&&
full_path
.
we_wordv
[
0
]
!=
NULL
)
{
strcpy
(
option
,
full_path
.
we_wordv
[
0
]);
}
wordfree
(
&
full_path
);
int
code
=
taosMkDir
(
option
,
0755
);
if
(
code
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
uError
(
"config option:%s, input value:%s, directory not exist, create fail:%s"
,
cfg
->
option
,
input_value
,
strerror
(
errno
));
uError
(
"config option:%s, input value:%s, directory not exist, create fail:%s"
,
cfg
->
option
,
input_value
,
strerror
(
errno
));
return
false
;
}
cfg
->
cfgStatus
=
TAOS_CFG_CSTATUS_FILE
;
}
else
{
...
...
@@ -130,6 +132,8 @@ static void taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
tsCfgStatusStr
[
cfg
->
cfgStatus
],
option
);
}
}
return
true
;
}
static
void
taosReadIpStrConfig
(
SGlobalCfg
*
cfg
,
char
*
input_value
)
{
...
...
@@ -225,8 +229,10 @@ static void taosReadConfigOption(const char *option, char *value, char *value2,
taosReadDirectoryConfig
(
cfg
,
value
);
break
;
case
TAOS_CFG_VTYPE_DATA_DIRCTORY
:
taosReadDirectoryConfig
(
cfg
,
value
);
taosReadDataDirCfg
(
value
,
value2
,
value3
);
if
(
taosReadDirectoryConfig
(
cfg
,
value
))
{
taosReadDataDirCfg
(
value
,
value2
,
value3
);
}
break
;
default:
uError
(
"config option:%s, input value:%s, can't be recognized"
,
option
,
value
);
break
;
...
...
@@ -349,10 +355,11 @@ bool taosReadGlobalCfg() {
value
[
vlen
]
=
0
;
paGetToken
(
value
+
vlen
+
1
,
&
value2
,
&
vlen2
);
if
(
vlen2
!=
0
)
value2
[
vlen2
]
=
0
;
paGetToken
(
value
+
vlen2
+
1
,
&
value3
,
&
vlen3
);
if
(
vlen3
!=
0
)
value3
[
vlen3
]
=
0
;
if
(
vlen2
!=
0
)
{
value2
[
vlen2
]
=
0
;
paGetToken
(
value2
+
vlen2
+
1
,
&
value3
,
&
vlen3
);
if
(
vlen3
!=
0
)
value3
[
vlen3
]
=
0
;
}
taosReadConfigOption
(
option
,
value
,
value2
,
value3
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录