Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c6fb4e92
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看板
提交
c6fb4e92
编写于
3月 01, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Also start taosd when the config file does not exis
上级
9359fe21
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
13 deletion
+28
-13
include/os/osDir.h
include/os/osDir.h
+1
-0
include/util/tconfig.h
include/util/tconfig.h
+1
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+12
-10
source/os/src/osDir.c
source/os/src/osDir.c
+9
-0
source/util/src/tconfig.c
source/util/src/tconfig.c
+5
-2
未找到文件。
include/os/osDir.h
浏览文件 @
c6fb4e92
...
...
@@ -26,6 +26,7 @@ int32_t taosMkDir(const char *dirname);
void
taosRemoveOldFiles
(
const
char
*
dirname
,
int32_t
keepDays
);
int32_t
taosExpandDir
(
const
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
);
int32_t
taosRealPath
(
char
*
dirname
,
int32_t
maxlen
);
bool
taosIsDir
(
const
char
*
dirname
);
#ifdef __cplusplus
}
...
...
include/util/tconfig.h
浏览文件 @
c6fb4e92
...
...
@@ -82,7 +82,7 @@ typedef struct SConfig {
SConfig
*
cfgInit
();
int32_t
cfgLoad
(
SConfig
*
pCfg
,
ECfgSrcType
cfgType
,
const
char
*
sourceStr
);
int32_t
cfgLoadArray
(
SConfig
*
pCfg
,
SArray
*
pArgs
);
// SConfigPair
int32_t
cfgLoad
From
Array
(
SConfig
*
pCfg
,
SArray
*
pArgs
);
// SConfigPair
void
cfgCleanup
(
SConfig
*
pCfg
);
int32_t
cfgGetSize
(
SConfig
*
pCfg
);
...
...
source/common/src/tglobal.c
浏览文件 @
c6fb4e92
...
...
@@ -177,24 +177,24 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char *inputCfgDir, const char *e
snprintf
(
cfgFile
,
sizeof
(
cfgFile
),
"%s"
TD_DIRSEP
"taos.cfg"
,
cfgDir
);
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_APOLLO_URL
,
apolloUrl
)
!=
0
)
{
uError
(
"failed to load from apollo url:%s since %s
\n
"
,
apolloUrl
,
terrstr
());
uError
(
"failed to load from apollo url:%s since %s"
,
apolloUrl
,
terrstr
());
return
-
1
;
}
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_CFG_FILE
,
cfg
File
)
!=
0
)
{
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_CFG_FILE
,
cfg
Dir
)
!=
0
)
{
uError
(
"failed to load from config file:%s since %s
\n
"
,
cfgFile
,
terrstr
());
return
-
1
;
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_CFG_FILE
,
cfg
Dir
)
!=
0
)
{
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_CFG_FILE
,
cfg
File
)
!=
0
)
{
uError
(
"failed to load from config file:%s since %s"
,
cfgFile
,
terrstr
());
return
0
;
}
}
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_ENV_FILE
,
envFile
)
!=
0
)
{
uError
(
"failed to load from env file:%s since %s
\n
"
,
envFile
,
terrstr
());
uError
(
"failed to load from env file:%s since %s"
,
envFile
,
terrstr
());
return
-
1
;
}
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_ENV_VAR
,
NULL
)
!=
0
)
{
uError
(
"failed to load from global env variables since %s
\n
"
,
terrstr
());
uError
(
"failed to load from global env variables since %s"
,
terrstr
());
return
-
1
;
}
...
...
@@ -438,8 +438,10 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
if
(
pCfg
==
NULL
)
return
-
1
;
if
(
tsc
)
{
tscEmbeddedInUtil
=
0
;
if
(
taosAddClientLogCfg
(
pCfg
)
!=
0
)
return
-
1
;
}
else
{
tscEmbeddedInUtil
=
1
;
if
(
taosAddClientLogCfg
(
pCfg
)
!=
0
)
return
-
1
;
if
(
taosAddServerLogCfg
(
pCfg
)
!=
0
)
return
-
1
;
}
...
...
@@ -450,7 +452,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
return
-
1
;
}
if
(
cfgLoadArray
(
pCfg
,
pArgs
)
!=
0
)
{
if
(
cfgLoad
From
Array
(
pCfg
,
pArgs
)
!=
0
)
{
uError
(
"failed to load cfg from array since %s"
,
terrstr
());
cfgCleanup
(
pCfg
);
return
-
1
;
...
...
@@ -466,7 +468,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
taosSetAllDebugFlag
(
cfgGetItem
(
pCfg
,
"debugFlag"
)
->
i32
);
if
(
taosInitLog
(
logname
,
logFileNum
)
!=
0
)
{
printf
(
"failed to init log file since %s
\n
"
,
terrstr
());
uError
(
"failed to init log file since %s
"
,
terrstr
());
cfgCleanup
(
pCfg
);
return
-
1
;
}
...
...
@@ -497,7 +499,7 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
return
-
1
;
}
if
(
cfgLoadArray
(
tsCfg
,
pArgs
)
!=
0
)
{
if
(
cfgLoad
From
Array
(
tsCfg
,
pArgs
)
!=
0
)
{
uError
(
"failed to load cfg from array since %s"
,
terrstr
());
cfgCleanup
(
tsCfg
);
return
-
1
;
...
...
source/os/src/osDir.c
浏览文件 @
c6fb4e92
...
...
@@ -140,4 +140,13 @@ int32_t taosRealPath(char *dirname, int32_t maxlen) {
return
0
;
}
bool
taosIsDir
(
const
char
*
dirname
)
{
DIR
*
dir
=
opendir
(
dirname
);
if
(
dir
!=
NULL
)
{
closedir
(
dir
);
return
true
;
}
return
false
;
}
#endif
source/util/src/tconfig.c
浏览文件 @
c6fb4e92
...
...
@@ -60,7 +60,7 @@ int32_t cfgLoad(SConfig *pCfg, ECfgSrcType cfgType, const char *sourceStr) {
}
}
int32_t
cfgLoadArray
(
SConfig
*
pCfg
,
SArray
*
pArgs
)
{
int32_t
cfgLoad
From
Array
(
SConfig
*
pCfg
,
SArray
*
pArgs
)
{
int32_t
size
=
taosArrayGetSize
(
pArgs
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SConfigPair
*
pPair
=
taosArrayGet
(
pArgs
,
i
);
...
...
@@ -608,7 +608,10 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) {
int32_t
olen
,
vlen
,
vlen2
,
vlen3
;
ssize_t
_bytes
=
0
;
// FILE *fp = fopen(filepath, "r");
if
(
taosIsDir
(
filepath
))
{
return
-
1
;
}
TdFilePtr
pFile
=
taosOpenFile
(
filepath
,
TD_FILE_READ
|
TD_FILE_STREAM
);
if
(
pFile
==
NULL
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录