Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7b054eac
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看板
提交
7b054eac
编写于
3月 04, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tfs monitor
上级
a6b168c7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
35 deletion
+42
-35
include/libs/monitor/monitor.h
include/libs/monitor/monitor.h
+1
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+39
-25
source/util/src/tconfig.c
source/util/src/tconfig.c
+2
-9
未找到文件。
include/libs/monitor/monitor.h
浏览文件 @
7b054eac
...
...
@@ -116,7 +116,7 @@ typedef struct {
typedef
struct
{
char
name
[
TSDB_FILENAME_LEN
];
int
32_t
level
;
int
8_t
level
;
SDiskSize
size
;
}
SMonDiskDesc
;
...
...
source/common/src/tglobal.c
浏览文件 @
7b054eac
...
...
@@ -155,21 +155,40 @@ static void taosAddDataDir(int32_t index, char *v1, int32_t level, int32_t prima
uTrace
(
"dataDir:%s, level:%d primary:%d is configured"
,
v1
,
level
,
primary
);
}
static
void
taosSetTfsCfg
(
SConfig
*
pCfg
)
{
static
int32_t
taosSetTfsCfg
(
SConfig
*
pCfg
)
{
SConfigItem
*
pItem
=
cfgGetItem
(
pCfg
,
"dataDir"
);
if
(
pItem
==
NULL
)
return
;
memset
(
tsDataDir
,
0
,
PATH_MAX
)
;
int32_t
size
=
taosArrayGetSize
(
pItem
->
array
);
if
(
size
<=
0
)
{
tsDiskCfgNum
=
1
;
taosAddDataDir
(
0
,
pItem
->
str
,
0
,
1
);
tstrncpy
(
tsDataDir
,
pItem
->
str
,
PATH_MAX
);
if
(
taosMkDir
(
tsDataDir
)
!=
0
)
{
uError
(
"failed to create dataDir:%s since %s"
,
tsDataDir
,
terrstr
());
return
-
1
;
}
}
else
{
tsDiskCfgNum
=
size
<
TFS_MAX_DISKS
?
size
:
TFS_MAX_DISKS
;
for
(
int32_t
index
=
0
;
index
<
tsDiskCfgNum
;
++
index
)
{
SDiskCfg
*
pCfg
=
taosArrayGet
(
pItem
->
array
,
index
);
memcpy
(
&
tsDiskCfg
[
index
],
pCfg
,
sizeof
(
SDiskCfg
));
if
(
pCfg
->
level
==
0
&&
pCfg
->
primary
==
1
)
{
tstrncpy
(
tsDataDir
,
pCfg
->
dir
,
PATH_MAX
);
}
if
(
taosMkDir
(
pCfg
->
dir
)
!=
0
)
{
uError
(
"failed to create tfsDir:%s since %s"
,
tsDataDir
,
terrstr
());
return
-
1
;
}
}
}
if
(
tsDataDir
[
0
]
==
0
)
{
uError
(
"datadir not set"
);
return
-
1
;
}
return
0
;
}
struct
SConfig
*
taosGetCfg
()
{
...
...
@@ -358,7 +377,7 @@ static void taosSetServerLogCfg(SConfig *pCfg) {
fsDebugFlag
=
cfgGetItem
(
pCfg
,
"fsDebugFlag"
)
->
i32
;
}
static
void
taosSetClientCfg
(
SConfig
*
pCfg
)
{
static
int32_t
taosSetClientCfg
(
SConfig
*
pCfg
)
{
tstrncpy
(
tsLocalFqdn
,
cfgGetItem
(
pCfg
,
"fqdn"
)
->
str
,
TSDB_FQDN_LEN
);
tsServerPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"serverPort"
)
->
i32
;
snprintf
(
tsLocalEp
,
sizeof
(
tsLocalEp
),
"%s:%u"
,
tsLocalFqdn
,
tsServerPort
);
...
...
@@ -375,9 +394,13 @@ static void taosSetClientCfg(SConfig *pCfg) {
snprintf
(
tsSecond
,
sizeof
(
tsSecond
),
"%s:%u"
,
secondEp
.
fqdn
,
secondEp
.
port
);
cfgSetItem
(
pCfg
,
"secondEp"
,
tsSecond
,
pSecondpItem
->
stype
);
tstrncpy
(
ts
Log
Dir
,
cfgGetItem
(
pCfg
,
"tempDir"
)
->
str
,
PATH_MAX
);
taosExpandDir
(
ts
LogDir
,
tsLog
Dir
,
PATH_MAX
);
tstrncpy
(
ts
Temp
Dir
,
cfgGetItem
(
pCfg
,
"tempDir"
)
->
str
,
PATH_MAX
);
taosExpandDir
(
ts
TempDir
,
tsTemp
Dir
,
PATH_MAX
);
tsTempSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalTempDirGB"
)
->
fval
;
if
(
taosMkDir
(
tsTempDir
)
!=
0
)
{
uError
(
"failed to create tempDir:%s since %s"
,
tsTempDir
,
terrstr
());
return
-
1
;
}
tsNumOfThreadsPerCore
=
cfgGetItem
(
pCfg
,
"maxTmrCtrl"
)
->
fval
;
tsMaxTmrCtrl
=
cfgGetItem
(
pCfg
,
"maxTmrCtrl"
)
->
i32
;
...
...
@@ -392,6 +415,8 @@ static void taosSetClientCfg(SConfig *pCfg) {
tsMaxNumOfOrderedResults
=
cfgGetItem
(
pCfg
,
"maxNumOfOrderedRes"
)
->
i32
;
tsKeepOriginalColumnName
=
cfgGetItem
(
pCfg
,
"keepColumnName"
)
->
bval
;
tsMaxBinaryDisplayWidth
=
cfgGetItem
(
pCfg
,
"maxBinaryDisplayWidth"
)
->
i32
;
return
0
;
}
static
void
taosSetSystemCfg
(
SConfig
*
pCfg
)
{
...
...
@@ -411,11 +436,8 @@ static void taosSetSystemCfg(SConfig *pCfg) {
tsVersion
=
30000000
;
}
static
void
taosSetServerCfg
(
SConfig
*
pCfg
)
{
tstrncpy
(
tsDataDir
,
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
,
PATH_MAX
);
taosExpandDir
(
tsDataDir
,
tsDataDir
,
PATH_MAX
);
tsTempSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
;
static
int32_t
taosSetServerCfg
(
SConfig
*
pCfg
)
{
tsDataSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
;
tsNumOfCommitThreads
=
cfgGetItem
(
pCfg
,
"numOfCommitThreads"
)
->
i32
;
tsRatioOfQueryCores
=
cfgGetItem
(
pCfg
,
"ratioOfQueryCores"
)
->
fval
;
tsMaxNumOfDistinctResults
=
cfgGetItem
(
pCfg
,
"maxNumOfDistinctRes"
)
->
i32
;
...
...
@@ -444,6 +466,8 @@ static void taosSetServerCfg(SConfig *pCfg) {
if
(
tsQueryBufferSize
>=
0
)
{
tsQueryBufferSizeBytes
=
tsQueryBufferSize
*
1048576UL
;
}
return
0
;
}
int32_t
taosCreateLog
(
const
char
*
logname
,
int32_t
logFileNum
,
const
char
*
cfgDir
,
const
char
*
envFile
,
...
...
@@ -504,8 +528,8 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
tsCfg
=
cfgInit
();
if
(
tsc
)
{
if
(
taosAddClientLogCfg
(
tsCfg
)
!=
0
)
return
-
1
;
if
(
taosAddClientCfg
(
tsCfg
)
!=
0
)
return
-
1
;
if
(
taosAddClientLogCfg
(
tsCfg
)
!=
0
)
return
-
1
;
}
else
{
if
(
taosAddClientCfg
(
tsCfg
)
!=
0
)
return
-
1
;
if
(
taosAddServerCfg
(
tsCfg
)
!=
0
)
return
-
1
;
...
...
@@ -528,24 +552,14 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
}
if
(
tsc
)
{
taosSetClientCfg
(
tsCfg
)
;
if
(
taosSetClientCfg
(
tsCfg
))
return
-
1
;
}
else
{
taosSetClientCfg
(
tsCfg
)
;
taosSetServerCfg
(
tsCfg
)
;
taosSetTfsCfg
(
tsCfg
)
;
if
(
taosSetClientCfg
(
tsCfg
))
return
-
1
;
if
(
taosSetServerCfg
(
tsCfg
))
return
-
1
;
if
(
taosSetTfsCfg
(
tsCfg
)
!=
0
)
return
-
1
;
}
taosSetSystemCfg
(
tsCfg
);
if
(
taosMkDir
(
tsTempDir
)
!=
0
)
{
uError
(
"failed to create dir:%s since %s"
,
tsTempDir
,
terrstr
());
return
-
1
;
}
if
(
!
tsc
&&
taosMkDir
(
tsDataDir
)
!=
0
)
{
uError
(
"failed to create dir:%s since %s"
,
tsDataDir
,
terrstr
());
return
-
1
;
}
cfgDumpCfg
(
tsCfg
,
tsc
,
false
);
return
0
;
}
...
...
source/util/src/tconfig.c
浏览文件 @
7b054eac
...
...
@@ -145,14 +145,7 @@ static int32_t cfgCheckAndSetDir(SConfigItem *pItem, const char *inputDir) {
return
-
1
;
}
#if 0
if (taosMkDir(fullDir) != 0) {
uError("failed to create dir:%s realpath:%s since %s", inputDir, fullDir, terrstr());
return -1;
}
#endif
cfgFreeItem
(
pItem
);
tfree
(
pItem
->
str
);
pItem
->
str
=
strdup
(
fullDir
);
if
(
pItem
->
str
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -647,7 +640,7 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) {
}
cfgSetItem
(
pConfig
,
name
,
value
,
CFG_STYPE_CFG_FILE
);
if
(
value2
!=
NULL
&&
value3
!=
NULL
&&
value2
[
0
]
!=
0
&&
value3
[
0
]
!=
0
)
{
if
(
value2
!=
NULL
&&
value3
!=
NULL
&&
value2
[
0
]
!=
0
&&
value3
[
0
]
!=
0
&&
strcasecmp
(
name
,
"dataDir"
)
==
0
)
{
cfgSetTfsItem
(
pConfig
,
name
,
value
,
value2
,
value3
,
CFG_STYPE_CFG_FILE
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录