Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0a0dfd5f
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
0a0dfd5f
编写于
2月 23, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename var
上级
460f7890
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
111 addition
and
77 deletion
+111
-77
include/libs/config/config.h
include/libs/config/config.h
+20
-18
source/dnode/mgmt/daemon/src/dmnCfg.c
source/dnode/mgmt/daemon/src/dmnCfg.c
+3
-5
source/libs/config/src/config.c
source/libs/config/src/config.c
+88
-54
未找到文件。
include/libs/config/config.h
浏览文件 @
0a0dfd5f
...
...
@@ -73,28 +73,30 @@ typedef struct SConfigItem {
typedef
struct
SConfig
SConfig
;
SConfig
*
cfgInit
();
int32_t
cfgLoad
(
SConfig
*
pC
onfi
g
,
ECfgSrcType
cfgType
,
const
char
*
sourceStr
);
void
cfgCleanup
(
SConfig
*
pC
onfi
g
);
int32_t
cfgGetSize
(
SConfig
*
pC
onfi
g
);
SConfigItem
*
cfgIterate
(
SConfig
*
pC
onfi
g
,
SConfigItem
*
pIter
);
void
cfgCancelIterate
(
SConfig
*
pC
onfi
g
,
SConfigItem
*
pIter
);
SConfigItem
*
cfgGetItem
(
SConfig
*
pC
onfi
g
,
const
char
*
name
);
int32_t
cfgAddBool
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
bool
defaultVal
);
int32_t
cfgAddInt32
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
int32_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
);
int32_t
cfgAddInt64
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
int64_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
);
int32_t
cfgAddFloat
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
float
defaultVal
,
double
minval
,
double
maxval
);
int32_t
cfgAddString
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
defaultVal
);
int32_t
cfgAddIpStr
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
defaultVa
);
int32_t
cfgAddDir
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
defaultVal
);
int32_t
cfgAddLocale
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
defaultVal
);
int32_t
cfgAddCharset
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
defaultVal
);
int32_t
cfgAddTimezone
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
defaultVal
);
int32_t
cfgLoad
(
SConfig
*
pC
f
g
,
ECfgSrcType
cfgType
,
const
char
*
sourceStr
);
void
cfgCleanup
(
SConfig
*
pC
f
g
);
int32_t
cfgGetSize
(
SConfig
*
pC
f
g
);
SConfigItem
*
cfgIterate
(
SConfig
*
pC
f
g
,
SConfigItem
*
pIter
);
void
cfgCancelIterate
(
SConfig
*
pC
f
g
,
SConfigItem
*
pIter
);
SConfigItem
*
cfgGetItem
(
SConfig
*
pC
f
g
,
const
char
*
name
);
int32_t
cfgAddBool
(
SConfig
*
pC
f
g
,
const
char
*
name
,
bool
defaultVal
);
int32_t
cfgAddInt32
(
SConfig
*
pC
f
g
,
const
char
*
name
,
int32_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
);
int32_t
cfgAddInt64
(
SConfig
*
pC
f
g
,
const
char
*
name
,
int64_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
);
int32_t
cfgAddFloat
(
SConfig
*
pC
f
g
,
const
char
*
name
,
float
defaultVal
,
double
minval
,
double
maxval
);
int32_t
cfgAddString
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
defaultVal
);
int32_t
cfgAddIpStr
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
defaultVa
);
int32_t
cfgAddDir
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
defaultVal
);
int32_t
cfgAddLocale
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
defaultVal
);
int32_t
cfgAddCharset
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
defaultVal
);
int32_t
cfgAddTimezone
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
defaultVal
);
const
char
*
cfgStypeStr
(
ECfgSrcType
type
);
const
char
*
cfgDtypeStr
(
ECfgDataType
type
);
void
cfgDumpCfg
(
SConfig
*
pCfg
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/mgmt/daemon/src/dmnCfg.c
浏览文件 @
0a0dfd5f
...
...
@@ -74,13 +74,11 @@ SConfig *dmnReadCfg(const char *cfgDir, const char *envFile, const char *apolloU
if
(
dmnCheckCfg
(
pCfg
)
!=
0
)
{
uError
(
"failed to check cfg since %s"
,
terrstr
());
}
if
(
taosCheckAndPrintCfg
()
!=
0
)
{
uError
(
"failed to check config"
);
cfgCleanup
(
pCfg
);
return
NULL
;
}
cfgDumpCfg
(
pCfg
);
return
pCfg
;
}
...
...
source/libs/config/src/config.c
浏览文件 @
0a0dfd5f
...
...
@@ -21,52 +21,52 @@
#include "ttimezone.h"
SConfig
*
cfgInit
()
{
SConfig
*
pC
onfi
g
=
calloc
(
1
,
sizeof
(
SConfig
));
if
(
pC
onfi
g
==
NULL
)
{
SConfig
*
pC
f
g
=
calloc
(
1
,
sizeof
(
SConfig
));
if
(
pC
f
g
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
pC
onfi
g
->
hash
=
taosHashInit
(
16
,
MurmurHash3_32
,
false
,
HASH_NO_LOCK
);
if
(
pC
onfi
g
->
hash
==
NULL
)
{
free
(
pC
onfi
g
);
pC
f
g
->
hash
=
taosHashInit
(
16
,
MurmurHash3_32
,
false
,
HASH_NO_LOCK
);
if
(
pC
f
g
->
hash
==
NULL
)
{
free
(
pC
f
g
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
return
pC
onfi
g
;
return
pC
f
g
;
}
int32_t
cfgLoad
(
SConfig
*
pC
onfi
g
,
ECfgSrcType
cfgType
,
const
char
*
sourceStr
)
{
int32_t
cfgLoad
(
SConfig
*
pC
f
g
,
ECfgSrcType
cfgType
,
const
char
*
sourceStr
)
{
switch
(
cfgType
)
{
case
CFG_STYPE_CFG_FILE
:
return
cfgLoadFromCfgFile
(
pC
onfi
g
,
sourceStr
);
return
cfgLoadFromCfgFile
(
pC
f
g
,
sourceStr
);
case
CFG_STYPE_ENV_FILE
:
return
cfgLoadFromEnvFile
(
pC
onfi
g
,
sourceStr
);
return
cfgLoadFromEnvFile
(
pC
f
g
,
sourceStr
);
case
CFG_STYPE_ENV_VAR
:
return
cfgLoadFromEnvVar
(
pC
onfi
g
);
return
cfgLoadFromEnvVar
(
pC
f
g
);
case
CFG_STYPE_APOLLO_URL
:
return
cfgLoadFromApollUrl
(
pC
onfi
g
,
sourceStr
);
return
cfgLoadFromApollUrl
(
pC
f
g
,
sourceStr
);
default:
return
-
1
;
}
}
void
cfgCleanup
(
SConfig
*
pC
onfi
g
)
{
if
(
pC
onfi
g
!=
NULL
)
{
if
(
pC
onfi
g
->
hash
!=
NULL
)
{
taosHashCleanup
(
pC
onfi
g
->
hash
);
pC
onfi
g
->
hash
==
NULL
;
void
cfgCleanup
(
SConfig
*
pC
f
g
)
{
if
(
pC
f
g
!=
NULL
)
{
if
(
pC
f
g
->
hash
!=
NULL
)
{
taosHashCleanup
(
pC
f
g
->
hash
);
pC
f
g
->
hash
==
NULL
;
}
free
(
pC
onfi
g
);
free
(
pC
f
g
);
}
}
int32_t
cfgGetSize
(
SConfig
*
pC
onfig
)
{
return
taosHashGetSize
(
pConfi
g
->
hash
);
}
int32_t
cfgGetSize
(
SConfig
*
pC
fg
)
{
return
taosHashGetSize
(
pCf
g
->
hash
);
}
SConfigItem
*
cfgIterate
(
SConfig
*
pC
onfig
,
SConfigItem
*
pIter
)
{
return
taosHashIterate
(
pConfi
g
->
hash
,
pIter
);
}
SConfigItem
*
cfgIterate
(
SConfig
*
pC
fg
,
SConfigItem
*
pIter
)
{
return
taosHashIterate
(
pCf
g
->
hash
,
pIter
);
}
void
cfgCancelIterate
(
SConfig
*
pC
onfig
,
SConfigItem
*
pIter
)
{
return
taosHashCancelIterate
(
pConfi
g
->
hash
,
pIter
);
}
void
cfgCancelIterate
(
SConfig
*
pC
fg
,
SConfigItem
*
pIter
)
{
return
taosHashCancelIterate
(
pCf
g
->
hash
,
pIter
);
}
static
int32_t
cfgCheckAndSetTimezone
(
SConfigItem
*
pItem
,
const
char
*
timezone
)
{
tfree
(
pItem
->
str
);
...
...
@@ -292,8 +292,8 @@ static int32_t cfgSetTimezone(SConfigItem *pItem, const char *value, ECfgSrcType
return
0
;
}
int32_t
cfgSetItem
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
value
,
ECfgSrcType
stype
)
{
SConfigItem
*
pItem
=
cfgGetItem
(
pC
onfi
g
,
name
);
int32_t
cfgSetItem
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
value
,
ECfgSrcType
stype
)
{
SConfigItem
*
pItem
=
cfgGetItem
(
pC
f
g
,
name
);
if
(
pItem
==
NULL
)
{
return
-
1
;
}
...
...
@@ -328,12 +328,12 @@ int32_t cfgSetItem(SConfig *pConfig, const char *name, const char *value, ECfgSr
return
-
1
;
}
SConfigItem
*
cfgGetItem
(
SConfig
*
pC
onfi
g
,
const
char
*
name
)
{
SConfigItem
*
cfgGetItem
(
SConfig
*
pC
f
g
,
const
char
*
name
)
{
char
lowcaseName
[
CFG_NAME_MAX_LEN
+
1
]
=
{
0
};
memcpy
(
lowcaseName
,
name
,
CFG_NAME_MAX_LEN
);
strntolower
(
lowcaseName
,
name
,
CFG_NAME_MAX_LEN
);
SConfigItem
*
pItem
=
taosHashGet
(
pC
onfi
g
->
hash
,
lowcaseName
,
strlen
(
lowcaseName
)
+
1
);
SConfigItem
*
pItem
=
taosHashGet
(
pC
f
g
->
hash
,
lowcaseName
,
strlen
(
lowcaseName
)
+
1
);
if
(
pItem
==
NULL
)
{
terrno
=
TSDB_CODE_CFG_NOT_FOUND
;
}
...
...
@@ -341,7 +341,7 @@ SConfigItem *cfgGetItem(SConfig *pConfig, const char *name) {
return
pItem
;
}
static
int32_t
cfgAddItem
(
SConfig
*
pC
onfi
g
,
SConfigItem
*
pItem
,
const
char
*
name
)
{
static
int32_t
cfgAddItem
(
SConfig
*
pC
f
g
,
SConfigItem
*
pItem
,
const
char
*
name
)
{
pItem
->
stype
=
CFG_STYPE_DEFAULT
;
pItem
->
name
=
strdup
(
name
);
if
(
pItem
->
name
==
NULL
)
{
...
...
@@ -353,7 +353,7 @@ static int32_t cfgAddItem(SConfig *pConfig, SConfigItem *pItem, const char *name
memcpy
(
lowcaseName
,
name
,
CFG_NAME_MAX_LEN
);
strntolower
(
lowcaseName
,
name
,
CFG_NAME_MAX_LEN
);
if
(
taosHashPut
(
pC
onfi
g
->
hash
,
lowcaseName
,
strlen
(
lowcaseName
)
+
1
,
pItem
,
sizeof
(
SConfigItem
))
!=
0
)
{
if
(
taosHashPut
(
pC
f
g
->
hash
,
lowcaseName
,
strlen
(
lowcaseName
)
+
1
,
pItem
,
sizeof
(
SConfigItem
))
!=
0
)
{
if
(
pItem
->
dtype
==
CFG_DTYPE_STRING
)
{
free
(
pItem
->
str
);
}
...
...
@@ -365,94 +365,94 @@ static int32_t cfgAddItem(SConfig *pConfig, SConfigItem *pItem, const char *name
return
0
;
}
int32_t
cfgAddBool
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
bool
defaultVal
)
{
int32_t
cfgAddBool
(
SConfig
*
pC
f
g
,
const
char
*
name
,
bool
defaultVal
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_BOOL
,
.
bval
=
defaultVal
};
return
cfgAddItem
(
pC
onfi
g
,
&
item
,
name
);
return
cfgAddItem
(
pC
f
g
,
&
item
,
name
);
}
int32_t
cfgAddInt32
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
int32_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
)
{
int32_t
cfgAddInt32
(
SConfig
*
pC
f
g
,
const
char
*
name
,
int32_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
)
{
if
(
defaultVal
<
minval
||
defaultVal
>
maxval
)
{
terrno
=
TSDB_CODE_OUT_OF_RANGE
;
return
-
1
;
}
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_INT32
,
.
i32
=
defaultVal
,
.
imin
=
minval
,
.
imax
=
maxval
};
return
cfgAddItem
(
pC
onfi
g
,
&
item
,
name
);
return
cfgAddItem
(
pC
f
g
,
&
item
,
name
);
}
int32_t
cfgAddInt64
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
int64_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
)
{
int32_t
cfgAddInt64
(
SConfig
*
pC
f
g
,
const
char
*
name
,
int64_t
defaultVal
,
int64_t
minval
,
int64_t
maxval
)
{
if
(
defaultVal
<
minval
||
defaultVal
>
maxval
)
{
terrno
=
TSDB_CODE_OUT_OF_RANGE
;
return
-
1
;
}
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_INT64
,
.
i64
=
defaultVal
,
.
imin
=
minval
,
.
imax
=
maxval
};
return
cfgAddItem
(
pC
onfi
g
,
&
item
,
name
);
return
cfgAddItem
(
pC
f
g
,
&
item
,
name
);
}
int32_t
cfgAddFloat
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
float
defaultVal
,
double
minval
,
double
maxval
)
{
int32_t
cfgAddFloat
(
SConfig
*
pC
f
g
,
const
char
*
name
,
float
defaultVal
,
double
minval
,
double
maxval
)
{
if
(
defaultVal
<
minval
||
defaultVal
>
maxval
)
{
terrno
=
TSDB_CODE_OUT_OF_RANGE
;
return
-
1
;
}
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_FLOAT
,
.
fval
=
defaultVal
,
.
fmin
=
minval
,
.
fmax
=
maxval
};
return
cfgAddItem
(
pC
onfi
g
,
&
item
,
name
);
return
cfgAddItem
(
pC
f
g
,
&
item
,
name
);
}
int32_t
cfgAddString
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
defaultVal
)
{
int32_t
cfgAddString
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
defaultVal
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_STRING
};
item
.
str
=
strdup
(
defaultVal
);
if
(
item
.
str
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
return
cfgAddItem
(
pC
onfi
g
,
&
item
,
name
);
return
cfgAddItem
(
pC
f
g
,
&
item
,
name
);
}
int32_t
cfgAddIpStr
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
defaultVal
)
{
int32_t
cfgAddIpStr
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
defaultVal
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_IPSTR
};
if
(
cfgCheckAndSetIpStr
(
&
item
,
defaultVal
)
!=
0
)
{
return
-
1
;
}
return
cfgAddItem
(
pC
onfi
g
,
&
item
,
name
);
return
cfgAddItem
(
pC
f
g
,
&
item
,
name
);
}
int32_t
cfgAddDir
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
defaultVal
)
{
int32_t
cfgAddDir
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
defaultVal
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_DIR
};
if
(
cfgCheckAndSetDir
(
&
item
,
defaultVal
)
!=
0
)
{
return
-
1
;
}
return
cfgAddItem
(
pC
onfi
g
,
&
item
,
name
);
return
cfgAddItem
(
pC
f
g
,
&
item
,
name
);
}
int32_t
cfgAddLocale
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
defaultVal
)
{
int32_t
cfgAddLocale
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
defaultVal
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_LOCALE
};
if
(
cfgCheckAndSetLocale
(
&
item
,
defaultVal
)
!=
0
)
{
return
-
1
;
}
return
cfgAddItem
(
pC
onfi
g
,
&
item
,
name
);
return
cfgAddItem
(
pC
f
g
,
&
item
,
name
);
}
int32_t
cfgAddCharset
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
defaultVal
)
{
int32_t
cfgAddCharset
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
defaultVal
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_CHARSET
};
if
(
cfgCheckAndSetCharset
(
&
item
,
defaultVal
)
!=
0
)
{
return
-
1
;
}
return
cfgAddItem
(
pC
onfi
g
,
&
item
,
name
);
return
cfgAddItem
(
pC
f
g
,
&
item
,
name
);
}
int32_t
cfgAddTimezone
(
SConfig
*
pC
onfi
g
,
const
char
*
name
,
const
char
*
defaultVal
)
{
int32_t
cfgAddTimezone
(
SConfig
*
pC
f
g
,
const
char
*
name
,
const
char
*
defaultVal
)
{
SConfigItem
item
=
{.
dtype
=
CFG_DTYPE_TIMEZONE
};
if
(
cfgCheckAndSetTimezone
(
&
item
,
defaultVal
)
!=
0
)
{
return
-
1
;
}
return
cfgAddItem
(
pC
onfi
g
,
&
item
,
name
);
return
cfgAddItem
(
pC
f
g
,
&
item
,
name
);
}
const
char
*
cfgStypeStr
(
ECfgSrcType
type
)
{
...
...
@@ -537,20 +537,54 @@ void cfgPrintCfg(SConfig *pCfg) {
}
}
int32_t
cfgCheck
(
SConfig
*
pConfig
)
{
void
cfgDumpCfg
(
SConfig
*
pCfg
)
{
uInfo
(
"global config"
);
uInfo
(
"=================================="
);
SConfigItem
*
pItem
=
cfgIterate
(
pCfg
,
NULL
);
while
(
pItem
!=
NULL
)
{
switch
(
pItem
->
dtype
)
{
case
CFG_DTYPE_BOOL
:
uInfo
(
"cfg:%s, value:%u src:%s"
,
pItem
->
name
,
pItem
->
bval
,
cfgStypeStr
(
pItem
->
stype
));
break
;
case
CFG_DTYPE_INT32
:
uInfo
(
"cfg:%s, value:%d src:%s"
,
pItem
->
name
,
pItem
->
i32
,
cfgStypeStr
(
pItem
->
stype
));
break
;
case
CFG_DTYPE_INT64
:
uInfo
(
"cfg:%s, value:%"
PRId64
" src:%s"
,
pItem
->
name
,
pItem
->
i64
,
cfgStypeStr
(
pItem
->
stype
));
break
;
case
CFG_DTYPE_FLOAT
:
uInfo
(
"cfg:%s, value:%f src:%s"
,
pItem
->
name
,
pItem
->
fval
,
cfgStypeStr
(
pItem
->
stype
));
break
;
case
CFG_DTYPE_STRING
:
case
CFG_DTYPE_IPSTR
:
case
CFG_DTYPE_DIR
:
case
CFG_DTYPE_LOCALE
:
case
CFG_DTYPE_CHARSET
:
case
CFG_DTYPE_TIMEZONE
:
uInfo
(
"cfg:%s, value:%s src:%s"
,
pItem
->
name
,
pItem
->
str
,
cfgStypeStr
(
pItem
->
stype
));
break
;
}
pItem
=
cfgIterate
(
pCfg
,
pItem
);
}
uInfo
(
"=================================="
);
}
int32_t
cfgCheck
(
SConfig
*
pCfg
)
{
SConfigItem
*
pItem
=
NULL
;
pItem
=
cfgGetItem
(
pC
onfi
g
,
"localFqdn"
);
pItem
=
cfgGetItem
(
pC
f
g
,
"localFqdn"
);
if
(
pItem
!=
NULL
)
{
tstrncpy
(
tsLocalFqdn
,
pItem
->
str
,
TSDB_FQDN_LEN
);
}
pItem
=
cfgGetItem
(
pC
onfi
g
,
"serverPort"
);
pItem
=
cfgGetItem
(
pC
f
g
,
"serverPort"
);
if
(
pItem
!=
NULL
)
{
tsServerPort
=
(
uint16_t
)
pItem
->
i32
;
}
pItem
=
cfgGetItem
(
pC
onfi
g
,
"firstEp"
);
pItem
=
cfgGetItem
(
pC
f
g
,
"firstEp"
);
if
(
pItem
!=
NULL
)
{
tstrncpy
(
tsFirst
,
pItem
->
str
,
TSDB_EP_LEN
);
}
...
...
@@ -566,7 +600,7 @@ int32_t cfgCheck(SConfig *pConfig) {
snprintf
(
tsFirst
,
TSDB_EP_LEN
,
"%s:%u"
,
ep
.
fqdn
,
ep
.
port
);
}
pItem
=
cfgGetItem
(
pC
onfi
g
,
"secondEp"
);
pItem
=
cfgGetItem
(
pC
f
g
,
"secondEp"
);
if
(
pItem
!=
NULL
)
{
tstrncpy
(
tsSecond
,
pItem
->
str
,
TSDB_EP_LEN
);
}
...
...
@@ -578,7 +612,7 @@ int32_t cfgCheck(SConfig *pConfig) {
snprintf
(
tsSecond
,
TSDB_EP_LEN
,
"%s:%u"
,
ep
.
fqdn
,
ep
.
port
);
}
pItem
=
cfgGetItem
(
pC
onfi
g
,
"dataDir"
);
pItem
=
cfgGetItem
(
pC
f
g
,
"dataDir"
);
if
(
pItem
!=
NULL
)
{
tstrncpy
(
tsDataDir
,
pItem
->
str
,
PATH_MAX
);
}
...
...
@@ -602,7 +636,7 @@ int32_t cfgCheck(SConfig *pConfig) {
tsSetTimeZone
();
// }
pItem
=
cfgGetItem
(
pC
onfi
g
,
"numOfCores"
);
pItem
=
cfgGetItem
(
pC
f
g
,
"numOfCores"
);
if
(
pItem
!=
NULL
)
{
tsNumOfCores
=
pItem
->
i32
;
}
...
...
@@ -615,7 +649,7 @@ int32_t cfgCheck(SConfig *pConfig) {
tsQueryBufferSizeBytes
=
tsQueryBufferSize
*
1048576UL
;
}
cfgPrintCfg
(
pC
onfi
g
);
cfgPrintCfg
(
pC
f
g
);
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录