Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
546d3e84
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
546d3e84
编写于
2月 24, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
daemon config
上级
da1351e3
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
84 addition
and
248 deletion
+84
-248
include/common/tglobal.h
include/common/tglobal.h
+2
-0
include/dnode/mgmt/dnode.h
include/dnode/mgmt/dnode.h
+0
-2
include/util/tconfig.h
include/util/tconfig.h
+1
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+11
-2
source/dnode/mgmt/daemon/inc/dmnInt.h
source/dnode/mgmt/daemon/inc/dmnInt.h
+3
-8
source/dnode/mgmt/daemon/src/dmnCfg.c
source/dnode/mgmt/daemon/src/dmnCfg.c
+10
-134
source/dnode/mgmt/daemon/src/dmnMain.c
source/dnode/mgmt/daemon/src/dmnMain.c
+10
-10
source/dnode/mgmt/impl/test/sut/src/sut.cpp
source/dnode/mgmt/impl/test/sut/src/sut.cpp
+0
-2
source/util/src/tconfig.c
source/util/src/tconfig.c
+47
-89
未找到文件。
include/common/tglobal.h
浏览文件 @
546d3e84
...
@@ -99,6 +99,8 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
...
@@ -99,6 +99,8 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
void
taosCleanupCfg
();
void
taosCleanupCfg
();
void
taosCfgDynamicOptions
(
const
char
*
option
,
const
char
*
value
);
void
taosCfgDynamicOptions
(
const
char
*
option
,
const
char
*
value
);
struct
SConfig
*
taosGetCfg
();
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
include/dnode/mgmt/dnode.h
浏览文件 @
546d3e84
...
@@ -32,8 +32,6 @@ typedef struct {
...
@@ -32,8 +32,6 @@ typedef struct {
uint16_t
numOfCommitThreads
;
uint16_t
numOfCommitThreads
;
bool
enableTelem
;
bool
enableTelem
;
bool
printAuth
;
bool
printAuth
;
int32_t
rpcTimer
;
int32_t
rpcMaxTime
;
}
SDnodeEnvCfg
;
}
SDnodeEnvCfg
;
/**
/**
...
...
include/util/tconfig.h
浏览文件 @
546d3e84
...
@@ -95,7 +95,7 @@ int32_t cfgAddTimezone(SConfig *pCfg, const char *name, const char *defaultVal);
...
@@ -95,7 +95,7 @@ int32_t cfgAddTimezone(SConfig *pCfg, const char *name, const char *defaultVal);
const
char
*
cfgStypeStr
(
ECfgSrcType
type
);
const
char
*
cfgStypeStr
(
ECfgSrcType
type
);
const
char
*
cfgDtypeStr
(
ECfgDataType
type
);
const
char
*
cfgDtypeStr
(
ECfgDataType
type
);
void
cfgDumpCfg
(
SConfig
*
pCfg
,
bool
tsc
);
void
cfgDumpCfg
(
SConfig
*
pCfg
,
bool
tsc
,
bool
dump
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/common/src/tglobal.c
浏览文件 @
546d3e84
...
@@ -170,6 +170,10 @@ static void taosPrintDataDirCfg() {
...
@@ -170,6 +170,10 @@ static void taosPrintDataDirCfg() {
}
}
}
}
struct
SConfig
*
taosGetCfg
()
{
return
tsCfg
;
}
static
int32_t
taosLoadCfg
(
SConfig
*
pCfg
,
const
char
*
inputCfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
)
{
static
int32_t
taosLoadCfg
(
SConfig
*
pCfg
,
const
char
*
inputCfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
)
{
char
cfgDir
[
PATH_MAX
]
=
{
0
};
char
cfgDir
[
PATH_MAX
]
=
{
0
};
char
cfgFile
[
PATH_MAX
+
100
]
=
{
0
};
char
cfgFile
[
PATH_MAX
+
100
]
=
{
0
};
...
@@ -332,6 +336,11 @@ static void taosSetClientCfg(SConfig *pCfg) {
...
@@ -332,6 +336,11 @@ static void taosSetClientCfg(SConfig *pCfg) {
tsServerPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"serverPort"
)
->
i32
;
tsServerPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"serverPort"
)
->
i32
;
snprintf
(
tsLocalEp
,
sizeof
(
tsLocalEp
),
"%s:%u"
,
tsLocalFqdn
,
tsServerPort
);
snprintf
(
tsLocalEp
,
sizeof
(
tsLocalEp
),
"%s:%u"
,
tsLocalFqdn
,
tsServerPort
);
SConfigItem
*
pItem
=
cfgGetItem
(
pCfg
,
"timezone"
);
osSetTimezone
(
pItem
->
str
);
uDebug
(
"timezone format changed from %s to %s"
,
pItem
->
str
,
osTimezone
());
cfgSetItem
(
pCfg
,
"timezone"
,
osTimezone
(),
pItem
->
stype
);
taosGetSystemInfo
();
taosGetSystemInfo
();
if
(
tsNumOfCores
<=
0
)
{
if
(
tsNumOfCores
<=
0
)
{
tsNumOfCores
=
1
;
tsNumOfCores
=
1
;
...
@@ -408,7 +417,7 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
...
@@ -408,7 +417,7 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
taosSetServerCfg
(
tsCfg
);
taosSetServerCfg
(
tsCfg
);
}
}
cfgDumpCfg
(
tsCfg
,
tsc
);
cfgDumpCfg
(
tsCfg
,
tsc
,
false
);
return
0
;
return
0
;
}
}
...
@@ -429,4 +438,4 @@ void taosCfgDynamicOptions(const char *option, const char *value) {
...
@@ -429,4 +438,4 @@ void taosCfgDynamicOptions(const char *option, const char *value) {
taosResetLog
();
taosResetLog
();
// taosPrintCfg();
// taosPrintCfg();
}
}
}
}
\ No newline at end of file
source/dnode/mgmt/daemon/inc/dmnInt.h
浏览文件 @
546d3e84
...
@@ -28,15 +28,10 @@
...
@@ -28,15 +28,10 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
int32_t
dmnAddLogCfg
(
SConfig
*
pCfg
);
SDnodeEnvCfg
dmnGetEnvCfg
();
int32_t
dmnInitLog
(
const
char
*
cfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
);
SDnodeObjCfg
dmnGetObjCfg
();
int32_t
dmnLoadCfg
(
SConfig
*
pConfig
,
const
char
*
inputCfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
);
SConfig
*
dmnReadCfg
(
const
char
*
cfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
);
void
dmnDumpCfg
();
SDnodeEnvCfg
dmnGetEnvCfg
(
SConfig
*
pCfg
);
SDnodeObjCfg
dmnGetObjCfg
(
SConfig
*
pCfg
);
void
dmnDumpCfg
(
SConfig
*
pCfg
);
void
dmnPrintVersion
();
void
dmnPrintVersion
();
void
dmnGenerateGrant
();
void
dmnGenerateGrant
();
...
...
source/dnode/mgmt/daemon/src/dmnCfg.c
浏览文件 @
546d3e84
...
@@ -15,131 +15,10 @@
...
@@ -15,131 +15,10 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "dmnInt.h"
#include "dmnInt.h"
#include "tconfig.h"
static
int32_t
dmnCheckDirCfg
(
SConfig
*
pCfg
)
{
SDnodeEnvCfg
dmnGetEnvCfg
()
{
SConfig
*
pCfg
=
taosGetCfg
();
return
0
;
}
static
int32_t
dmnAddDnodeCfg
(
SConfig
*
pCfg
)
{
if
(
dmnAddEpCfg
(
pCfg
)
!=
0
)
return
-
1
;
if
(
dmnAddDirCfg
(
pCfg
)
!=
0
)
return
-
1
;
if
(
dmnAddVersionCfg
(
pCfg
)
!=
0
)
return
-
1
;
if
(
cfgAddTimezone
(
pCfg
,
"timezone"
,
""
)
!=
0
)
return
-
1
;
if
(
cfgAddLocale
(
pCfg
,
"locale"
,
""
)
!=
0
)
return
-
1
;
if
(
cfgAddCharset
(
pCfg
,
"charset"
,
""
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"numOfCores"
,
2
,
1
,
100000
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"numOfCommitThreads"
,
4
,
1
,
1000
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"telemetryReporting"
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"enableCoreFile"
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"supportVnodes"
,
256
,
0
,
65536
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"statusInterval"
,
1
,
1
,
30
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"numOfThreadsPerCore"
,
1
,
0
,
10
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"ratioOfQueryCores"
,
1
,
0
,
5
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxShellConns"
,
50000
,
10
,
50000000
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"shellActivityTimer"
,
3
,
1
,
120
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcTimer"
,
300
,
100
,
3000
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcMaxTime"
,
600
,
100
,
7200
)
!=
0
)
return
-
1
;
return
0
;
}
static
void
dmnSetDnodeCfg
(
SConfig
*
pCfg
)
{
SConfigItem
*
pItem
=
cfgGetItem
(
pCfg
,
"timezone"
);
osSetTimezone
(
pItem
->
str
);
uDebug
(
"timezone format changed from %s to %s"
,
pItem
->
str
,
osTimezone
());
cfgSetItem
(
pCfg
,
"timezone"
,
osTimezone
(),
pItem
->
stype
);
}
static
int32_t
dmnCheckCfg
(
SConfig
*
pCfg
)
{
bool
enableCore
=
cfgGetItem
(
pCfg
,
"enableCoreFile"
)
->
bval
;
taosSetCoreDump
(
enableCore
);
dmnSetDnodeCfg
(
pCfg
);
if
(
dmnCheckDirCfg
(
pCfg
)
!=
0
)
{
return
-
1
;
}
taosGetSystemInfo
();
if
(
tsNumOfCores
<=
0
)
{
tsNumOfCores
=
1
;
}
if
(
tsQueryBufferSize
>=
0
)
{
tsQueryBufferSizeBytes
=
tsQueryBufferSize
*
1048576UL
;
}
return
0
;
}
SConfig
*
dmnReadCfg
(
const
char
*
cfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
)
{
SConfig
*
pCfg
=
cfgInit
();
if
(
pCfg
==
NULL
)
return
NULL
;
if
(
dmnAddLogCfg
(
pCfg
)
!=
0
)
{
uError
(
"failed to add log cfg since %s"
,
terrstr
());
cfgCleanup
(
pCfg
);
return
NULL
;
}
if
(
dmnAddDnodeCfg
(
pCfg
)
!=
0
)
{
uError
(
"failed to init dnode cfg since %s"
,
terrstr
());
cfgCleanup
(
pCfg
);
return
NULL
;
}
if
(
dmnLoadCfg
(
pCfg
,
cfgDir
,
envFile
,
apolloUrl
)
!=
0
)
{
uError
(
"failed to load cfg since %s"
,
terrstr
());
cfgCleanup
(
pCfg
);
return
NULL
;
}
if
(
dmnCheckCfg
(
pCfg
)
!=
0
)
{
uError
(
"failed to check cfg since %s"
,
terrstr
());
cfgCleanup
(
pCfg
);
return
NULL
;
}
cfgDumpCfg
(
pCfg
);
return
pCfg
;
}
void
dmnDumpCfg
(
SConfig
*
pCfg
)
{
printf
(
"taos global config:
\n
"
);
printf
(
"==================================
\n
"
);
SConfigItem
*
pItem
=
cfgIterate
(
pCfg
,
NULL
);
while
(
pItem
!=
NULL
)
{
switch
(
pItem
->
dtype
)
{
case
CFG_DTYPE_BOOL
:
printf
(
"cfg:%s, value:%u src:%s
\n
"
,
pItem
->
name
,
pItem
->
bval
,
cfgStypeStr
(
pItem
->
stype
));
break
;
case
CFG_DTYPE_INT32
:
printf
(
"cfg:%s, value:%d src:%s
\n
"
,
pItem
->
name
,
pItem
->
i32
,
cfgStypeStr
(
pItem
->
stype
));
break
;
case
CFG_DTYPE_INT64
:
printf
(
"cfg:%s, value:%"
PRId64
" src:%s
\n
"
,
pItem
->
name
,
pItem
->
i64
,
cfgStypeStr
(
pItem
->
stype
));
break
;
case
CFG_DTYPE_FLOAT
:
printf
(
"cfg:%s, value:%f src:%s
\n
"
,
pItem
->
name
,
pItem
->
fval
,
cfgStypeStr
(
pItem
->
stype
));
break
;
case
CFG_DTYPE_STRING
:
case
CFG_DTYPE_DIR
:
case
CFG_DTYPE_LOCALE
:
case
CFG_DTYPE_CHARSET
:
case
CFG_DTYPE_TIMEZONE
:
printf
(
"cfg:%s, value:%s src:%s
\n
"
,
pItem
->
name
,
pItem
->
str
,
cfgStypeStr
(
pItem
->
stype
));
break
;
}
pItem
=
cfgIterate
(
pCfg
,
pItem
);
}
}
SDnodeEnvCfg
dmnGetEnvCfg
(
SConfig
*
pCfg
)
{
SDnodeEnvCfg
envCfg
=
{
0
};
SDnodeEnvCfg
envCfg
=
{
0
};
const
char
*
vstr
=
cfgGetItem
(
pCfg
,
"version"
)
->
str
;
const
char
*
vstr
=
cfgGetItem
(
pCfg
,
"version"
)
->
str
;
...
@@ -147,27 +26,24 @@ SDnodeEnvCfg dmnGetEnvCfg(SConfig *pCfg) {
...
@@ -147,27 +26,24 @@ SDnodeEnvCfg dmnGetEnvCfg(SConfig *pCfg) {
envCfg
.
numOfCores
=
cfgGetItem
(
pCfg
,
"numOfCores"
)
->
i32
;
envCfg
.
numOfCores
=
cfgGetItem
(
pCfg
,
"numOfCores"
)
->
i32
;
envCfg
.
numOfCommitThreads
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"numOfCommitThreads"
)
->
i32
;
envCfg
.
numOfCommitThreads
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"numOfCommitThreads"
)
->
i32
;
envCfg
.
enableTelem
=
cfgGetItem
(
pCfg
,
"telemetryReporting"
)
->
bval
;
envCfg
.
enableTelem
=
cfgGetItem
(
pCfg
,
"telemetryReporting"
)
->
bval
;
envCfg
.
rpcMaxTime
=
cfgGetItem
(
pCfg
,
"rpcMaxTime"
)
->
i32
;
envCfg
.
rpcTimer
=
cfgGetItem
(
pCfg
,
"rpcTimer"
)
->
i32
;
return
envCfg
;
return
envCfg
;
}
}
SDnodeObjCfg
dmnGetObjCfg
(
SConfig
*
pCfg
)
{
SDnodeObjCfg
dmnGetObjCfg
()
{
SConfig
*
pCfg
=
taosGetCfg
();
SDnodeObjCfg
objCfg
=
{
0
};
SDnodeObjCfg
objCfg
=
{
0
};
objCfg
.
numOfSupportVnodes
=
cfgGetItem
(
pCfg
,
"supportVnodes"
)
->
i32
;
objCfg
.
numOfSupportVnodes
=
cfgGetItem
(
pCfg
,
"supportVnodes"
)
->
i32
;
// objCfg.statusInterval = cfgGetItem(pCfg, "statusInterval")->i32;
// objCfg.numOfThreadsPerCore = cfgGetItem(pCfg, "numOfThreadsPerCore")->fval;
// objCfg.ratioOfQueryCores = cfgGetItem(pCfg, "ratioOfQueryCores")->fval;
// objCfg.maxShellConns = cfgGetItem(pCfg, "maxShellConns")->i32;
// objCfg.shellActivityTimer = cfgGetItem(pCfg, "shellActivityTimer")->i32;
tstrncpy
(
objCfg
.
dataDir
,
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
,
sizeof
(
objCfg
.
dataDir
));
tstrncpy
(
objCfg
.
dataDir
,
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
,
sizeof
(
objCfg
.
dataDir
));
tstrncpy
(
objCfg
.
firstEp
,
cfgGetItem
(
pCfg
,
"firstEp"
)
->
str
,
sizeof
(
objCfg
.
firstEp
));
tstrncpy
(
objCfg
.
firstEp
,
cfgGetItem
(
pCfg
,
"firstEp"
)
->
str
,
sizeof
(
objCfg
.
firstEp
));
tstrncpy
(
objCfg
.
secondEp
,
cfgGetItem
(
pCfg
,
"secondEp"
)
->
str
,
sizeof
(
objCfg
.
firstEp
));
tstrncpy
(
objCfg
.
secondEp
,
cfgGetItem
(
pCfg
,
"secondEp"
)
->
str
,
sizeof
(
objCfg
.
firstEp
));
objCfg
.
serverPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"serverPort"
)
->
i32
;
objCfg
.
serverPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"serverPort"
)
->
i32
;
tstrncpy
(
objCfg
.
localFqdn
,
cfgGetItem
(
pCfg
,
"fqdn"
)
->
str
,
sizeof
(
objCfg
.
localFqdn
));
tstrncpy
(
objCfg
.
localFqdn
,
cfgGetItem
(
pCfg
,
"fqdn"
)
->
str
,
sizeof
(
objCfg
.
localFqdn
));
snprintf
(
objCfg
.
localEp
,
sizeof
(
objCfg
.
localEp
),
"%s:%u"
,
objCfg
.
localFqdn
,
objCfg
.
serverPort
);
snprintf
(
objCfg
.
localEp
,
sizeof
(
objCfg
.
localEp
),
"%s:%u"
,
objCfg
.
localFqdn
,
objCfg
.
serverPort
);
return
objCfg
;
return
objCfg
;
}
void
dmnDumpCfg
()
{
SConfig
*
pCfg
=
taosGetCfg
();
cfgDumpCfg
(
pCfg
,
0
,
1
);
}
}
\ No newline at end of file
source/dnode/mgmt/daemon/src/dmnMain.c
浏览文件 @
546d3e84
...
@@ -72,14 +72,14 @@ static int32_t dmnParseOption(int32_t argc, char const *argv[]) {
...
@@ -72,14 +72,14 @@ static int32_t dmnParseOption(int32_t argc, char const *argv[]) {
return
0
;
return
0
;
}
}
int32_t
dmnRunDnode
(
SConfig
*
pCfg
)
{
int32_t
dmnRunDnode
()
{
SDnodeEnvCfg
envCfg
=
dmnGetEnvCfg
(
pCfg
);
SDnodeEnvCfg
envCfg
=
dmnGetEnvCfg
();
if
(
dndInit
(
&
envCfg
)
!=
0
)
{
if
(
dndInit
(
&
envCfg
)
!=
0
)
{
uInfo
(
"Failed to start TDengine, please check the log"
);
uInfo
(
"Failed to start TDengine, please check the log"
);
return
-
1
;
return
-
1
;
}
}
SDnodeObjCfg
objCfg
=
dmnGetObjCfg
(
pCfg
);
SDnodeObjCfg
objCfg
=
dmnGetObjCfg
();
SDnode
*
pDnode
=
dndCreate
(
&
objCfg
);
SDnode
*
pDnode
=
dndCreate
(
&
objCfg
);
if
(
pDnode
==
NULL
)
{
if
(
pDnode
==
NULL
)
{
uInfo
(
"Failed to start TDengine, please check the log"
);
uInfo
(
"Failed to start TDengine, please check the log"
);
...
@@ -113,23 +113,23 @@ int main(int argc, char const *argv[]) {
...
@@ -113,23 +113,23 @@ int main(int argc, char const *argv[]) {
return
0
;
return
0
;
}
}
if
(
dmnInitLog
(
configDir
,
dmn
.
envFile
,
dmn
.
apolloUrl
)
!=
0
)
{
if
(
taosCreateLog
(
"taosdlog"
,
1
,
configDir
,
dmn
.
envFile
,
dmn
.
apolloUrl
,
1
)
!=
0
)
{
uInfo
(
"Failed to start TDengine since read config error"
);
return
-
1
;
return
-
1
;
}
}
SConfig
*
pCfg
=
dmnReadCfg
(
configDir
,
dmn
.
envFile
,
dmn
.
apolloUrl
);
if
(
taosInitCfg
(
configDir
,
dmn
.
envFile
,
dmn
.
apolloUrl
,
1
)
!=
0
)
{
if
(
pCfg
==
NULL
)
{
uInfo
(
"Failed to start TDengine since read config error"
);
uInfo
(
"Failed to start TDengine since read config error"
);
return
-
1
;
return
-
1
;
}
}
if
(
dmn
.
dumpConfig
)
{
if
(
dmn
.
dumpConfig
)
{
dmnDumpCfg
(
pCfg
);
dmnDumpCfg
();
cfgCleanup
(
pCfg
);
taosCleanupCfg
(
);
return
0
;
return
0
;
}
}
int32_t
code
=
dmnRunDnode
(
pCfg
);
int32_t
code
=
dmnRunDnode
();
cfgCleanup
(
pCfg
);
taosCleanupCfg
(
);
return
code
;
return
code
;
}
}
source/dnode/mgmt/impl/test/sut/src/sut.cpp
浏览文件 @
546d3e84
...
@@ -43,8 +43,6 @@ void Testbase::Init(const char* path, int16_t port) {
...
@@ -43,8 +43,6 @@ void Testbase::Init(const char* path, int16_t port) {
SDnodeEnvCfg
cfg
=
{
0
};
SDnodeEnvCfg
cfg
=
{
0
};
cfg
.
numOfCommitThreads
=
1
;
cfg
.
numOfCommitThreads
=
1
;
cfg
.
numOfCores
=
1
;
cfg
.
numOfCores
=
1
;
cfg
.
rpcMaxTime
=
600
;
cfg
.
rpcTimer
=
300
;
dndInit
(
&
cfg
);
dndInit
(
&
cfg
);
char
fqdn
[]
=
"localhost"
;
char
fqdn
[]
=
"localhost"
;
...
...
source/util/src/tconfig.c
浏览文件 @
546d3e84
...
@@ -475,9 +475,16 @@ const char *cfgDtypeStr(ECfgDataType type) {
...
@@ -475,9 +475,16 @@ const char *cfgDtypeStr(ECfgDataType type) {
}
}
}
}
void
cfgDumpCfg
(
SConfig
*
pCfg
,
bool
tsc
)
{
void
cfgDumpCfg
(
SConfig
*
pCfg
,
bool
tsc
,
bool
dump
)
{
uInfo
(
" global config"
);
if
(
dump
)
{
uInfo
(
"================================================================="
);
printf
(
" global config"
);
printf
(
"
\n
"
);
printf
(
"================================================================="
);
printf
(
"
\n
"
);
}
else
{
uInfo
(
" global config"
);
uInfo
(
"================================================================="
);
}
char
src
[
CFG_SRC_PRINT_LEN
+
1
]
=
{
0
};
char
src
[
CFG_SRC_PRINT_LEN
+
1
]
=
{
0
};
char
name
[
CFG_NAME_PRINT_LEN
+
1
]
=
{
0
};
char
name
[
CFG_NAME_PRINT_LEN
+
1
]
=
{
0
};
...
@@ -497,111 +504,62 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc) {
...
@@ -497,111 +504,62 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc) {
switch
(
pItem
->
dtype
)
{
switch
(
pItem
->
dtype
)
{
case
CFG_DTYPE_BOOL
:
case
CFG_DTYPE_BOOL
:
uInfo
(
"%s %s %u"
,
src
,
name
,
pItem
->
bval
);
if
(
dump
)
{
printf
(
"%s %s %u"
,
src
,
name
,
pItem
->
bval
);
printf
(
"
\n
"
);
}
else
{
uInfo
(
"%s %s %u"
,
src
,
name
,
pItem
->
bval
);
}
break
;
break
;
case
CFG_DTYPE_INT32
:
case
CFG_DTYPE_INT32
:
uInfo
(
"%s %s %d"
,
src
,
name
,
pItem
->
i32
);
if
(
dump
)
{
printf
(
"%s %s %d"
,
src
,
name
,
pItem
->
i32
);
printf
(
"
\n
"
);
}
else
{
uInfo
(
"%s %s %d"
,
src
,
name
,
pItem
->
i32
);
}
break
;
break
;
case
CFG_DTYPE_INT64
:
case
CFG_DTYPE_INT64
:
uInfo
(
"%s %s %"
PRId64
,
src
,
name
,
pItem
->
i64
);
if
(
dump
)
{
printf
(
"%s %s %"
PRId64
,
src
,
name
,
pItem
->
i64
);
printf
(
"
\n
"
);
}
else
{
uInfo
(
"%s %s %"
PRId64
,
src
,
name
,
pItem
->
i64
);
}
break
;
break
;
case
CFG_DTYPE_FLOAT
:
case
CFG_DTYPE_FLOAT
:
uInfo
(
"%s %s %f"
,
src
,
name
,
pItem
->
fval
);
if
(
dump
)
{
printf
(
"%s %s %f"
,
src
,
name
,
pItem
->
fval
);
printf
(
"
\n
"
);
}
else
{
uInfo
(
"%s %s %f"
,
src
,
name
,
pItem
->
fval
);
}
break
;
break
;
case
CFG_DTYPE_STRING
:
case
CFG_DTYPE_STRING
:
case
CFG_DTYPE_DIR
:
case
CFG_DTYPE_DIR
:
case
CFG_DTYPE_LOCALE
:
case
CFG_DTYPE_LOCALE
:
case
CFG_DTYPE_CHARSET
:
case
CFG_DTYPE_CHARSET
:
case
CFG_DTYPE_TIMEZONE
:
case
CFG_DTYPE_TIMEZONE
:
uInfo
(
"%s %s %s"
,
src
,
name
,
pItem
->
str
);
if
(
dump
)
{
printf
(
"%s %s %s"
,
src
,
name
,
pItem
->
str
);
printf
(
"
\n
"
);
}
else
{
uInfo
(
"%s %s %s"
,
src
,
name
,
pItem
->
str
);
}
break
;
break
;
}
}
pItem
=
cfgIterate
(
pCfg
,
pItem
);
pItem
=
cfgIterate
(
pCfg
,
pItem
);
}
}
uInfo
(
"================================================================="
);
if
(
dump
)
{
printf
(
"================================================================="
);
printf
(
"
\n
"
);
}
else
{
uInfo
(
"================================================================="
);
}
}
}
#if 0
// int32_t cfgCheck(SConfig *pCfg) {
// SConfigItem *pItem = NULL;
// pItem = cfgGetItem(pCfg, "serverPort");
// if (pItem != NULL) {
// tsServerPort = (uint16_t)pItem->i32;
// }
// pItem = cfgGetItem(pCfg, "firstEp");
// if (pItem != NULL) {
// tstrncpy(tsFirst, pItem->str, TSDB_EP_LEN);
// }
// snprintf(tsLocalEp, TSDB_EP_LEN, "%s:%u", tsLocalFqdn, tsServerPort);
// uInfo("localEp is: %s", tsLocalEp);
// SEp ep = {0};
// if (tsFirst[0] == 0) {
// strcpy(tsFirst, tsLocalEp);
// } else {
// taosGetFqdnPortFromEp(tsFirst, &ep);
// snprintf(tsFirst, TSDB_EP_LEN, "%s:%u", ep.fqdn, ep.port);
// }
// pItem = cfgGetItem(pCfg, "secondEp");
// if (pItem != NULL) {
// tstrncpy(tsSecond, pItem->str, TSDB_EP_LEN);
// }
// if (tsSecond[0] == 0) {
// strcpy(tsSecond, tsLocalEp);
// } else {
// taosGetFqdnPortFromEp(tsSecond, &ep);
// snprintf(tsSecond, TSDB_EP_LEN, "%s:%u", ep.fqdn, ep.port);
// }
// pItem = cfgGetItem(pCfg, "dataDir");
// if (pItem != NULL) {
// tstrncpy(osDataDir(), pItem->str, PATH_MAX);
// }
// if (tsDiskCfgNum <= 0) {
// taosAddDataDir(0, osDataDir(), 0, 1);
// tsDiskCfgNum = 1;
// uTrace("dataDir:%s, level:0 primary:1 is configured by default", osDataDir());
// }
// if (taosDirExist(osTempDir()) != 0) {
// return -1;
// }
// taosGetSystemInfo();
// tsSetLocale();
// // SGlobalCfg *cfg_timezone = taosGetConfigOption("timezone");
// // if (cfg_timezone && cfg_timezone->cfgStatus == TAOS_CFG_CSTATUS_FILE) {
// tsSetTimeZone();
// // }
// pItem = cfgGetItem(pCfg, "numOfCores");
// if (pItem != NULL) {
// tsNumOfCores = pItem->i32;
// }
// if (tsNumOfCores <= 0) {
// tsNumOfCores = 1;
// }
// if (tsQueryBufferSize >= 0) {
// tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL;
// }
// cfgPrintCfg(pCfg);
// return 0;
// }
#endif
int32_t
cfgLoadFromEnvVar
(
SConfig
*
pConfig
)
{
int32_t
cfgLoadFromEnvVar
(
SConfig
*
pConfig
)
{
uInfo
(
"load from global env variables"
);
uInfo
(
"load from global env variables"
);
return
0
;
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录