Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e321edbe
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看板
提交
e321edbe
编写于
2月 24, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
config
上级
42784396
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
29 addition
and
81 deletion
+29
-81
include/util/tconfig.h
include/util/tconfig.h
+0
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+29
-79
source/util/src/tconfig.c
source/util/src/tconfig.c
+0
-1
未找到文件。
include/util/tconfig.h
浏览文件 @
e321edbe
...
@@ -42,7 +42,6 @@ typedef enum {
...
@@ -42,7 +42,6 @@ typedef enum {
CFG_DTYPE_INT64
,
CFG_DTYPE_INT64
,
CFG_DTYPE_FLOAT
,
CFG_DTYPE_FLOAT
,
CFG_DTYPE_STRING
,
CFG_DTYPE_STRING
,
CFG_DTYPE_IPSTR
,
CFG_DTYPE_DIR
,
CFG_DTYPE_DIR
,
CFG_DTYPE_LOCALE
,
CFG_DTYPE_LOCALE
,
CFG_DTYPE_CHARSET
,
CFG_DTYPE_CHARSET
,
...
...
source/common/src/tglobal.c
浏览文件 @
e321edbe
...
@@ -26,6 +26,8 @@
...
@@ -26,6 +26,8 @@
#include "tutil.h"
#include "tutil.h"
#include "ulog.h"
#include "ulog.h"
SConfig
*
tsCfg
=
NULL
;
// cluster
// cluster
int32_t
tsVersion
=
30000000
;
int32_t
tsVersion
=
30000000
;
int32_t
tsStatusInterval
=
1
;
// second
int32_t
tsStatusInterval
=
1
;
// second
...
@@ -140,16 +142,14 @@ uint32_t tsMaxRange = 500; // max range
...
@@ -140,16 +142,14 @@ uint32_t tsMaxRange = 500; // max range
uint32_t
tsCurRange
=
100
;
// range
uint32_t
tsCurRange
=
100
;
// range
char
tsCompressor
[
32
]
=
"ZSTD_COMPRESSOR"
;
// ZSTD_COMPRESSOR or GZIP_COMPRESSOR
char
tsCompressor
[
32
]
=
"ZSTD_COMPRESSOR"
;
// ZSTD_COMPRESSOR or GZIP_COMPRESSOR
#if 0
static
void
taosAddDataDir
(
int32_t
index
,
char
*
v1
,
int32_t
level
,
int32_t
primary
)
{
void taosAddDataDir(int index, char *v1, int level, int primary) {
tstrncpy
(
tsDiskCfg
[
index
].
dir
,
v1
,
TSDB_FILENAME_LEN
);
tstrncpy
(
tsDiskCfg
[
index
].
dir
,
v1
,
TSDB_FILENAME_LEN
);
tsDiskCfg
[
index
].
level
=
level
;
tsDiskCfg
[
index
].
level
=
level
;
tsDiskCfg
[
index
].
primary
=
primary
;
tsDiskCfg
[
index
].
primary
=
primary
;
uTrace
(
"dataDir:%s, level:%d primary:%d is configured"
,
v1
,
level
,
primary
);
uTrace
(
"dataDir:%s, level:%d primary:%d is configured"
,
v1
,
level
,
primary
);
}
}
static
void
taosReadDataDirCfg
(
char
*
v1
,
char
*
v2
,
char
*
v3
)
{
void taosReadDataDirCfg(char *v1, char *v2, char *v3) {
if
(
tsDiskCfgNum
==
1
)
{
if
(
tsDiskCfgNum
==
1
)
{
SDiskCfg
*
cfg
=
&
tsDiskCfg
[
0
];
SDiskCfg
*
cfg
=
&
tsDiskCfg
[
0
];
uInfo
(
"dataDir:%s, level:%d primary:%d is replaced by %s"
,
cfg
->
dir
,
cfg
->
level
,
cfg
->
primary
,
v1
);
uInfo
(
"dataDir:%s, level:%d primary:%d is replaced by %s"
,
cfg
->
dir
,
cfg
->
level
,
cfg
->
primary
,
v1
);
...
@@ -158,79 +158,12 @@ void taosReadDataDirCfg(char *v1, char *v2, char *v3) {
...
@@ -158,79 +158,12 @@ void taosReadDataDirCfg(char *v1, char *v2, char *v3) {
tsDiskCfgNum
=
1
;
tsDiskCfgNum
=
1
;
}
}
void taosPrintDataDirCfg() {
static
void
taosPrintDataDirCfg
()
{
for (int i = 0; i < tsDiskCfgNum; ++i) {
for
(
int
32_t
i
=
0
;
i
<
tsDiskCfgNum
;
++
i
)
{
SDiskCfg
*
cfg
=
&
tsDiskCfg
[
i
];
SDiskCfg
*
cfg
=
&
tsDiskCfg
[
i
];
uInfo
(
" dataDir: %s"
,
cfg
->
dir
);
uInfo
(
" dataDir: %s"
,
cfg
->
dir
);
}
}
}
}
#endif
#if 0
void taosInitGlobalCfg() { pthread_once(&tsInitGlobalCfgOnce, doInitGlobalConfig); }
int32_t taosCheckAndPrintCfg() {
SEp ep = {0};
if (debugFlag & DEBUG_TRACE || debugFlag & DEBUG_DEBUG || debugFlag & DEBUG_DUMP) {
taosSetAllDebugFlag();
}
if (tsLocalFqdn[0] == 0) {
taosGetFqdn(tsLocalFqdn);
}
snprintf(tsLocalEp, sizeof(tsLocalEp), "%s:%u", tsLocalFqdn, tsServerPort);
uInfo("localEp is: %s", tsLocalEp);
if (tsFirst[0] == 0) {
strcpy(tsFirst, tsLocalEp);
} else {
taosGetFqdnPortFromEp(tsFirst, &ep);
snprintf(tsFirst, sizeof(tsFirst), "%s:%u", ep.fqdn, ep.port);
}
if (tsSecond[0] == 0) {
strcpy(tsSecond, tsLocalEp);
} else {
taosGetFqdnPortFromEp(tsSecond, &ep);
snprintf(tsSecond, sizeof(tsSecond), "%s:%u", ep.fqdn, ep.port);
}
taosCheckDataDirCfg();
if (taosDirExist(tsTempDir) != 0) {
return -1;
}
taosGetSystemInfo();
tsSetLocale();
SGlobalCfg *cfg_timezone = taosGetConfigOption("timezone");
if (cfg_timezone && cfg_timezone->cfgStatus == TAOS_CFG_CSTATUS_FILE) {
tsSetTimeZone();
}
if (tsNumOfCores <= 0) {
tsNumOfCores = 1;
}
if (tsQueryBufferSize >= 0) {
tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL;
}
uInfo(" check global cfg completed");
uInfo("==================================");
taosPrintCfg();
return 0;
}
void taosPrintLog(){}
#endif
static
SConfig
*
tsCfg
=
NULL
;
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
};
...
@@ -331,7 +264,7 @@ static void taosAddClientCfg(SConfig *pCfg) {
...
@@ -331,7 +264,7 @@ static void taosAddClientCfg(SConfig *pCfg) {
cfgAddString
(
pCfg
,
"buildinfo"
,
buildinfo
,
1
);
cfgAddString
(
pCfg
,
"buildinfo"
,
buildinfo
,
1
);
cfgAddTimezone
(
pCfg
,
"timezone"
,
osTimezone
());
cfgAddTimezone
(
pCfg
,
"timezone"
,
osTimezone
());
cfgAddLocale
(
pCfg
,
"locale"
,
osLocale
());
cfgAddLocale
(
pCfg
,
"locale"
,
osLocale
());
cfgAddCharset
(
pCfg
,
"charset"
,
osCharset
);
cfgAddCharset
(
pCfg
,
"charset"
,
osCharset
()
);
}
}
static
void
taosAddServerCfg
(
SConfig
*
pCfg
)
{
static
void
taosAddServerCfg
(
SConfig
*
pCfg
)
{
...
@@ -388,11 +321,21 @@ static void taosSetServerLogCfg(SConfig *pCfg) {
...
@@ -388,11 +321,21 @@ static void taosSetServerLogCfg(SConfig *pCfg) {
static
void
taosSetClientCfg
(
SConfig
*
pCfg
)
{
static
void
taosSetClientCfg
(
SConfig
*
pCfg
)
{
osSetTempDir
(
cfgGetItem
(
pCfg
,
"tempDir"
)
->
str
);
osSetTempDir
(
cfgGetItem
(
pCfg
,
"tempDir"
)
->
str
);
osSetDataReservedSpace
(
cfgGetItem
(
pCfg
,
"minimalTempDirGB"
)
->
fval
);
osSetDataReservedSpace
(
cfgGetItem
(
pCfg
,
"minimalTempDirGB"
)
->
fval
);
taosGetSystemInfo
();
if
(
tsNumOfCores
<=
0
)
{
tsNumOfCores
=
1
;
}
}
}
static
void
taosSetServerCfg
(
SConfig
*
pCfg
)
{
static
void
taosSetServerCfg
(
SConfig
*
pCfg
)
{
osSetDataDir
(
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
);
osSetDataDir
(
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
);
osSetTempReservedSpace
(
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
);
osSetTempReservedSpace
(
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
);
tsQueryBufferSize
=
cfgGetItem
(
pCfg
,
"queryBufferSize"
)
->
i32
;
if
(
tsQueryBufferSize
>=
0
)
{
tsQueryBufferSizeBytes
=
tsQueryBufferSize
*
1048576UL
;
}
}
}
int32_t
taosCreateLog
(
const
char
*
logname
,
int32_t
logFileNum
,
const
char
*
cfgDir
,
const
char
*
envFile
,
int32_t
taosCreateLog
(
const
char
*
logname
,
int32_t
logFileNum
,
const
char
*
cfgDir
,
const
char
*
envFile
,
...
@@ -401,13 +344,13 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
...
@@ -401,13 +344,13 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
if
(
tsCfg
==
NULL
)
return
-
1
;
if
(
tsCfg
==
NULL
)
return
-
1
;
if
(
tsc
)
{
if
(
tsc
)
{
aosAddClientLogCfg
(
pCfg
);
t
aosAddClientLogCfg
(
pCfg
);
}
else
{
}
else
{
t
t
aosAddServerLogCfg
(
pCfg
);
taosAddServerLogCfg
(
pCfg
);
}
}
if
(
taosLoadCfg
(
tsCfg
,
cfgDir
,
envFile
,
apolloUrl
)
!=
0
)
{
if
(
taosLoadCfg
(
tsCfg
,
cfgDir
,
envFile
,
apolloUrl
)
!=
0
)
{
uError
(
"failed to load cfg since %"
,
terrstr
());
uError
(
"failed to load cfg since %
s
"
,
terrstr
());
cfgCleanup
(
pCfg
);
cfgCleanup
(
pCfg
);
return
-
1
;
return
-
1
;
}
}
...
@@ -440,7 +383,7 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
...
@@ -440,7 +383,7 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
}
}
if
(
taosLoadCfg
(
tsCfg
,
cfgDir
,
envFile
,
apolloUrl
)
!=
0
)
{
if
(
taosLoadCfg
(
tsCfg
,
cfgDir
,
envFile
,
apolloUrl
)
!=
0
)
{
uError
(
"failed to load cfg since %"
,
terrstr
());
uError
(
"failed to load cfg since %
s
"
,
terrstr
());
cfgCleanup
(
tsCfg
);
cfgCleanup
(
tsCfg
);
tsCfg
=
NULL
;
tsCfg
=
NULL
;
return
-
1
;
return
-
1
;
...
@@ -452,10 +395,17 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
...
@@ -452,10 +395,17 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
taosSetServerCfg
(
tsCfg
);
taosSetServerCfg
(
tsCfg
);
}
}
cfgDumpCfg
(
tsCfg
);
cfgDumpCfg
(
tsCfg
,
tsc
);
return
0
;
return
0
;
}
}
void
taosCleanupCfg
()
{
if
(
tsCfg
)
{
cfgCleanup
(
tsCfg
);
tsCfg
=
NULL
;
}
}
void
taosCfgDynamicOptions
(
const
char
*
option
,
const
char
*
value
)
{
void
taosCfgDynamicOptions
(
const
char
*
option
,
const
char
*
value
)
{
if
(
strcasecmp
(
option
,
"debugFlag"
)
==
0
)
{
if
(
strcasecmp
(
option
,
"debugFlag"
)
==
0
)
{
int32_t
debugFlag
=
atoi
(
value
);
int32_t
debugFlag
=
atoi
(
value
);
...
...
source/util/src/tconfig.c
浏览文件 @
e321edbe
...
@@ -509,7 +509,6 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc) {
...
@@ -509,7 +509,6 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc) {
uInfo
(
"%s %s %f"
,
src
,
name
,
pItem
->
fval
);
uInfo
(
"%s %s %f"
,
src
,
name
,
pItem
->
fval
);
break
;
break
;
case
CFG_DTYPE_STRING
:
case
CFG_DTYPE_STRING
:
case
CFG_DTYPE_IPSTR
:
case
CFG_DTYPE_DIR
:
case
CFG_DTYPE_DIR
:
case
CFG_DTYPE_LOCALE
:
case
CFG_DTYPE_LOCALE
:
case
CFG_DTYPE_CHARSET
:
case
CFG_DTYPE_CHARSET
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录