Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
460f7890
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
460f7890
编写于
2月 23, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
log variables
上级
06a7ba7b
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
178 addition
and
162 deletion
+178
-162
include/util/tlog.h
include/util/tlog.h
+4
-8
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+1
-3
source/common/src/tglobal.c
source/common/src/tglobal.c
+0
-16
source/dnode/mgmt/daemon/inc/dmnInt.h
source/dnode/mgmt/daemon/inc/dmnInt.h
+5
-6
source/dnode/mgmt/daemon/src/daemon.c
source/dnode/mgmt/daemon/src/daemon.c
+10
-14
source/dnode/mgmt/daemon/src/dmnCfg.c
source/dnode/mgmt/daemon/src/dmnCfg.c
+40
-59
source/dnode/mgmt/daemon/src/dmnLog.c
source/dnode/mgmt/daemon/src/dmnLog.c
+79
-16
source/dnode/mgmt/daemon/src/dmnUtil.c
source/dnode/mgmt/daemon/src/dmnUtil.c
+1
-1
source/dnode/mgmt/impl/test/sut/src/sut.cpp
source/dnode/mgmt/impl/test/sut/src/sut.cpp
+1
-5
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+1
-3
source/libs/config/src/config.c
source/libs/config/src/config.c
+1
-4
source/libs/qworker/test/qworkerTests.cpp
source/libs/qworker/test/qworkerTests.cpp
+1
-3
source/libs/scheduler/test/schedulerTests.cpp
source/libs/scheduler/test/schedulerTests.cpp
+1
-3
source/libs/transport/test/pushClient.c
source/libs/transport/test/pushClient.c
+1
-1
source/libs/transport/test/pushServer.c
source/libs/transport/test/pushServer.c
+1
-1
source/libs/transport/test/rclient.c
source/libs/transport/test/rclient.c
+1
-1
source/libs/transport/test/rsclient.c
source/libs/transport/test/rsclient.c
+1
-1
source/libs/transport/test/rserver.c
source/libs/transport/test/rserver.c
+1
-1
source/libs/transport/test/syncClient.c
source/libs/transport/test/syncClient.c
+1
-1
source/util/src/tlog.c
source/util/src/tlog.c
+26
-13
source/util/src/ttimer.c
source/util/src/ttimer.c
+0
-1
source/util/test/trefTest.c
source/util/test/trefTest.c
+1
-1
未找到文件。
include/util/tlog.h
浏览文件 @
460f7890
...
...
@@ -23,7 +23,7 @@ extern "C" {
#endif
// log
extern
int8_t
tsAsyncLog
;
extern
bool
tsAsyncLog
;
extern
int32_t
tsNumOfLogLines
;
extern
int32_t
tsLogKeepDays
;
extern
int32_t
dDebugFlag
;
...
...
@@ -32,9 +32,6 @@ extern int32_t mDebugFlag;
extern
int32_t
cDebugFlag
;
extern
int32_t
jniDebugFlag
;
extern
int32_t
tmrDebugFlag
;
extern
int32_t
httpDebugFlag
;
extern
int32_t
mqttDebugFlag
;
extern
int32_t
monDebugFlag
;
extern
int32_t
uDebugFlag
;
extern
int32_t
rpcDebugFlag
;
extern
int32_t
qDebugFlag
;
...
...
@@ -42,8 +39,7 @@ extern int32_t wDebugFlag;
extern
int32_t
sDebugFlag
;
extern
int32_t
tsdbDebugFlag
;
extern
int32_t
tqDebugFlag
;
extern
int32_t
cqDebugFlag
;
extern
int32_t
debugFlag
;
extern
int32_t
fsDebugFlag
;
#define DEBUG_FATAL 1U
#define DEBUG_ERROR DEBUG_FATAL
...
...
@@ -56,7 +52,7 @@ extern int32_t debugFlag;
#define DEBUG_SCREEN 64U
#define DEBUG_FILE 128U
int32_t
taosInitLog
(
c
har
*
logName
,
int32_t
numOfLogLines
,
int32_t
maxFiles
);
int32_t
taosInitLog
(
c
onst
char
*
logName
,
int32_t
maxFiles
);
void
taosCloseLog
();
void
taosResetLog
();
...
...
@@ -75,7 +71,7 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
void
taosDumpData
(
unsigned
char
*
msg
,
int32_t
len
);
void
taosSetDebugFlag
(
int32_t
flag
);
void
taosSet
All
DebugFlag
(
int32_t
flag
);
#ifdef __cplusplus
}
...
...
source/client/src/clientEnv.c
浏览文件 @
460f7890
...
...
@@ -82,9 +82,7 @@ static void tscInitLogFile() {
const char *defaultLogFileNamePrefix = "taoslog";
const int32_t maxLogFileNum = 10;
char temp[128] = {0};
sprintf(temp, "%s/%s", tsLogDir, defaultLogFileNamePrefix);
if (taosInitLog(temp, tsNumOfLogLines, maxLogFileNum) < 0) {
if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
printf("failed to open log file in directory:%s\n", tsLogDir);
}
#endif
...
...
source/common/src/tglobal.c
浏览文件 @
460f7890
...
...
@@ -178,22 +178,6 @@ char *qtypeStr[] = {"rpc", "fwd", "wal", "cq", "query"};
static
pthread_once_t
tsInitGlobalCfgOnce
=
PTHREAD_ONCE_INIT
;
void
taosSetAllDebugFlag
()
{
if
(
debugFlag
!=
0
)
{
mDebugFlag
=
debugFlag
;
dDebugFlag
=
debugFlag
;
vDebugFlag
=
debugFlag
;
jniDebugFlag
=
debugFlag
;
qDebugFlag
=
debugFlag
;
rpcDebugFlag
=
debugFlag
;
uDebugFlag
=
debugFlag
;
sDebugFlag
=
debugFlag
;
wDebugFlag
=
debugFlag
;
tsdbDebugFlag
=
debugFlag
;
cqDebugFlag
=
debugFlag
;
uInfo
(
"all debug flag are set to %d"
,
debugFlag
);
}
}
int32_t
taosCfgDynamicOptions
(
char
*
msg
)
{
#if 0
...
...
source/dnode/mgmt/daemon/inc/dmnInt.h
浏览文件 @
460f7890
...
...
@@ -19,25 +19,24 @@
#include "config.h"
#include "dnode.h"
#include "taoserror.h"
#include "tglobal.h"
#include "ulog.h"
#include "taoserror.h"
#ifdef __cplusplus
extern
"C"
{
#endif
int32_t
dmn
Init
LogCfg
(
SConfig
*
pCfg
);
int32_t
dmn
Add
LogCfg
(
SConfig
*
pCfg
);
int32_t
dmnInitLog
(
const
char
*
cfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
);
int32_t
dmnLoadCfg
(
SConfig
*
pConfig
,
const
char
*
inputCfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
);
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
);
SConfig
*
dmnReadCfg
(
const
char
*
cfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
);
SDnodeEnvCfg
dmnGetEnvCfg
(
SConfig
*
pCfg
);
SDnodeObjCfg
dmnGetObjCfg
(
SConfig
*
pCfg
);
void
dmnDumpCfg
(
SConfig
*
pCfg
);
void
dmnPrintVersion
(
SConfig
*
pCfg
);
void
dmnPrintVersion
();
void
dmnGenerateGrant
();
#ifdef __cplusplus
...
...
source/dnode/mgmt/daemon/src/daemon.c
浏览文件 @
460f7890
...
...
@@ -22,7 +22,6 @@ static struct {
bool
generateGrant
;
bool
printAuth
;
bool
printVersion
;
char
configDir
[
PATH_MAX
];
char
envFile
[
PATH_MAX
];
char
apolloUrl
[
PATH_MAX
];
}
dmn
=
{
0
};
...
...
@@ -48,8 +47,6 @@ static void dmnWaitSignal() {
}
static
int32_t
dmnParseOption
(
int32_t
argc
,
char
const
*
argv
[])
{
tstrncpy
(
dmn
.
configDir
,
"/etc/taos"
,
PATH_MAX
);
for
(
int32_t
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
strcmp
(
argv
[
i
],
"-c"
)
==
0
)
{
if
(
i
<
argc
-
1
)
{
...
...
@@ -57,7 +54,7 @@ static int32_t dmnParseOption(int32_t argc, char const *argv[]) {
printf
(
"config file path overflow"
);
return
-
1
;
}
tstrncpy
(
dmn
.
configDir
,
argv
[
i
],
PATH_MAX
);
tstrncpy
(
configDir
,
argv
[
i
],
PATH_MAX
);
}
else
{
printf
(
"'-c' requires a parameter, default is %s
\n
"
,
configDir
);
return
-
1
;
...
...
@@ -105,26 +102,25 @@ int main(int argc, char const *argv[]) {
}
if
(
dmn
.
generateGrant
)
{
dmnGenerateGrant
();
return
0
;
dmnGenerateGrant
();
return
0
;
}
if
(
dmn
.
printVersion
)
{
dmnPrintVersion
();
return
0
;
}
if
(
dmnInitLog
(
dmn
.
configDir
,
dmn
.
envFile
,
dmn
.
apolloUrl
)
!=
0
)
{
if
(
dmnInitLog
(
configDir
,
dmn
.
envFile
,
dmn
.
apolloUrl
)
!=
0
)
{
return
-
1
;
}
SConfig
*
pCfg
=
dmnReadCfg
(
dmn
.
configDir
,
dmn
.
envFile
,
dmn
.
apolloUrl
);
SConfig
*
pCfg
=
dmnReadCfg
(
configDir
,
dmn
.
envFile
,
dmn
.
apolloUrl
);
if
(
pCfg
==
NULL
)
{
uInfo
(
"Failed to start TDengine since read config error"
);
return
-
1
;
}
if
(
dmn
.
printVersion
)
{
dmnPrintVersion
(
pCfg
);
cfgCleanup
(
pCfg
);
return
0
;
}
if
(
dmn
.
dumpConfig
)
{
dmnDumpCfg
(
pCfg
);
cfgCleanup
(
pCfg
);
...
...
source/dnode/mgmt/daemon/src/dmnCfg.c
浏览文件 @
460f7890
...
...
@@ -16,91 +16,72 @@
#define _DEFAULT_SOURCE
#include "dmnInt.h"
static
int32_t
dmnInitDnodeCfg
(
SConfig
*
pConfig
)
{
if
(
cfgAddString
(
pConfig
,
"version"
,
version
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pConfig
,
"buildinfo"
,
buildinfo
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pConfig
,
"gitinfo"
,
gitinfo
)
!=
0
)
return
-
1
;
if
(
cfgAddTimezone
(
pConfig
,
"timezone"
,
""
)
!=
0
)
return
-
1
;
if
(
cfgAddLocale
(
pConfig
,
"locale"
,
""
)
!=
0
)
return
-
1
;
if
(
cfgAddCharset
(
pConfig
,
"charset"
,
""
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pConfig
,
"numOfCores"
,
1
,
1
,
100000
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pConfig
,
"numOfCommitThreads"
,
4
,
1
,
1000
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pConfig
,
"telemetryReporting"
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pConfig
,
"enableCoreFile"
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pConfig
,
"supportVnodes"
,
256
,
0
,
65536
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pConfig
,
"statusInterval"
,
1
,
1
,
30
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pConfig
,
"numOfThreadsPerCore"
,
1
,
0
,
10
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pConfig
,
"ratioOfQueryCores"
,
1
,
0
,
5
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pConfig
,
"maxShellConns"
,
50000
,
10
,
50000000
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pConfig
,
"shellActivityTimer"
,
3
,
1
,
120
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pConfig
,
"serverPort"
,
6030
,
1
,
65056
)
!=
0
)
return
-
1
;
static
int32_t
dmnAddDnodeCfg
(
SConfig
*
pCfg
)
{
if
(
cfgAddString
(
pCfg
,
"buildinfo"
,
buildinfo
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"gitinfo"
,
gitinfo
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"version"
,
version
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"firstEp"
,
""
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"secondEp"
,
""
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"fqdn"
,
""
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"serverPort"
,
6030
,
1
,
65056
)
!=
0
)
return
-
1
;
if
(
cfgAddDir
(
pCfg
,
"dataDir"
,
tsDataDir
)
!=
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"
,
1
,
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
;
return
0
;
}
int32_t
dmnLoadCfg
(
SConfig
*
pConfig
,
const
char
*
inputCfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
)
{
char
configDir
[
PATH_MAX
]
=
{
0
};
char
configFile
[
PATH_MAX
+
100
]
=
{
0
};
taosExpandDir
(
inputCfgDir
,
configDir
,
PATH_MAX
);
snprintf
(
configFile
,
sizeof
(
configFile
),
"%s"
TD_DIRSEP
"taos.cfg"
,
configDir
);
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_APOLLO_URL
,
apolloUrl
)
!=
0
)
{
uError
(
"failed to load from apollo url:%s since %s
\n
"
,
apolloUrl
,
terrstr
());
return
-
1
;
}
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_CFG_FILE
,
configFile
)
!=
0
)
{
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_CFG_FILE
,
configDir
)
!=
0
)
{
uError
(
"failed to load from config file:%s since %s
\n
"
,
configFile
,
terrstr
());
return
-
1
;
}
}
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_ENV_FILE
,
envFile
)
!=
0
)
{
uError
(
"failed to load from env file:%s since %s
\n
"
,
envFile
,
terrstr
());
return
-
1
;
}
int32_t
dmnCheckCfg
(
SConfig
*
pCfg
)
{
bool
enableCore
=
cfgGetItem
(
pCfg
,
"enableCoreFile"
)
->
bval
;
taosSetCoreDump
(
enableCore
);
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_ENV_VAR
,
NULL
)
!=
0
)
{
uError
(
"failed to load from global env variables since %s
\n
"
,
terrstr
());
return
-
1
;
}
return
0
;
}
SConfig
*
dmnReadCfg
(
const
char
*
cfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
)
{
SConfig
*
pC
onfi
g
=
cfgInit
();
if
(
pC
onfi
g
==
NULL
)
return
NULL
;
SConfig
*
pC
f
g
=
cfgInit
();
if
(
pC
f
g
==
NULL
)
return
NULL
;
if
(
dmn
InitLogCfg
(
pConfi
g
)
!=
0
)
{
uError
(
"failed to init log cfg since %s
"
,
terrstr
());
cfgCleanup
(
pC
onfi
g
);
if
(
dmn
AddLogCfg
(
pCf
g
)
!=
0
)
{
printf
(
"failed to add log cfg since %s
\n
"
,
terrstr
());
cfgCleanup
(
pC
f
g
);
return
NULL
;
}
if
(
dmn
InitDnodeCfg
(
pConfi
g
)
!=
0
)
{
if
(
dmn
AddDnodeCfg
(
pCf
g
)
!=
0
)
{
uError
(
"failed to init dnode cfg since %s"
,
terrstr
());
cfgCleanup
(
pC
onfi
g
);
cfgCleanup
(
pC
f
g
);
return
NULL
;
}
if
(
dmnLoadCfg
(
pC
onfi
g
,
cfgDir
,
envFile
,
apolloUrl
)
!=
0
)
{
if
(
dmnLoadCfg
(
pC
f
g
,
cfgDir
,
envFile
,
apolloUrl
)
!=
0
)
{
uError
(
"failed to load cfg since %s"
,
terrstr
());
cfgCleanup
(
pC
onfi
g
);
cfgCleanup
(
pC
f
g
);
return
NULL
;
}
bool
enableCore
=
cfgGetItem
(
pConfig
,
"enableCoreFile"
)
->
bval
;
taosSetCoreDump
(
enableCore
);
if
(
dmnCheckCfg
(
pCfg
)
!=
0
)
{
uError
(
"failed to check cfg since %s"
,
terrstr
());
}
if
(
taosCheckAndPrintCfg
()
!=
0
)
{
uError
(
"failed to check config"
);
return
NULL
;
}
return
pConfig
;
return
pCfg
;
}
void
dmnDumpCfg
(
SConfig
*
pCfg
)
{
...
...
@@ -146,7 +127,7 @@ SDnodeEnvCfg dmnGetEnvCfg(SConfig *pCfg) {
tstrncpy
(
envCfg
.
locale
,
cfgGetItem
(
pCfg
,
"locale"
)
->
str
,
sizeof
(
envCfg
.
locale
));
tstrncpy
(
envCfg
.
charset
,
cfgGetItem
(
pCfg
,
"charset"
)
->
str
,
sizeof
(
envCfg
.
charset
));
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
;
return
envCfg
;
...
...
source/dnode/mgmt/daemon/src/dmnLog.c
浏览文件 @
460f7890
...
...
@@ -16,25 +16,52 @@
#define _DEFAULT_SOURCE
#include "dmnInt.h"
int32_t
dmn
Init
LogCfg
(
SConfig
*
pCfg
)
{
int32_t
dmn
Add
LogCfg
(
SConfig
*
pCfg
)
{
if
(
cfgAddDir
(
pCfg
,
"logDir"
,
"/var/log/taos"
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"asyncLog"
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"numOfLogLines"
,
10000000
,
1000
,
2000000000
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"logKeepDays"
,
0
,
-
365000
,
365000
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"asyncLog"
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"debugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"mDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"dDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"sDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"wDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"tmrDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"vDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"mDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"cDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"jniDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"tmrDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"uDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"qDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"vDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"wDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"sDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"tsdbDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"cqDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"tqDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"fsDebugFlag"
,
0
,
0
,
255
)
!=
0
)
return
-
1
;
return
0
;
}
int32_t
dmnSetLogCfg
(
SConfig
*
pCfg
)
{
tstrncpy
(
tsLogDir
,
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
,
PATH_MAX
);
tsAsyncLog
=
cfgGetItem
(
pCfg
,
"asyncLog"
)
->
bval
;
tsNumOfLogLines
=
cfgGetItem
(
pCfg
,
"numOfLogLines"
)
->
i32
;
tsLogKeepDays
=
cfgGetItem
(
pCfg
,
"logKeepDays"
)
->
i32
;
dDebugFlag
=
cfgGetItem
(
pCfg
,
"dDebugFlag"
)
->
i32
;
vDebugFlag
=
cfgGetItem
(
pCfg
,
"vDebugFlag"
)
->
i32
;
mDebugFlag
=
cfgGetItem
(
pCfg
,
"mDebugFlag"
)
->
i32
;
cDebugFlag
=
cfgGetItem
(
pCfg
,
"cDebugFlag"
)
->
i32
;
jniDebugFlag
=
cfgGetItem
(
pCfg
,
"jniDebugFlag"
)
->
i32
;
tmrDebugFlag
=
cfgGetItem
(
pCfg
,
"tmrDebugFlag"
)
->
i32
;
uDebugFlag
=
cfgGetItem
(
pCfg
,
"uDebugFlag"
)
->
i32
;
rpcDebugFlag
=
cfgGetItem
(
pCfg
,
"rpcDebugFlag"
)
->
i32
;
qDebugFlag
=
cfgGetItem
(
pCfg
,
"qDebugFlag"
)
->
i32
;
wDebugFlag
=
cfgGetItem
(
pCfg
,
"wDebugFlag"
)
->
i32
;
sDebugFlag
=
cfgGetItem
(
pCfg
,
"sDebugFlag"
)
->
i32
;
tsdbDebugFlag
=
cfgGetItem
(
pCfg
,
"tsdbDebugFlag"
)
->
i32
;
tqDebugFlag
=
cfgGetItem
(
pCfg
,
"tqDebugFlag"
)
->
i32
;
fsDebugFlag
=
cfgGetItem
(
pCfg
,
"fsDebugFlag"
)
->
i32
;
int32_t
debugFlag
=
cfgGetItem
(
pCfg
,
"debugFlag"
)
->
i32
;
taosSetAllDebugFlag
(
debugFlag
);
return
0
;
}
...
...
@@ -42,22 +69,26 @@ int32_t dmnInitLog(const char *cfgDir, const char *envFile, const char *apolloUr
SConfig
*
pCfg
=
cfgInit
();
if
(
pCfg
==
NULL
)
return
-
1
;
if
(
dmn
Init
LogCfg
(
pCfg
)
!=
0
)
{
uError
(
"failed to init
log cfg since %s
\n
"
,
terrstr
());
if
(
dmn
Add
LogCfg
(
pCfg
)
!=
0
)
{
printf
(
"failed to add
log cfg since %s
\n
"
,
terrstr
());
cfgCleanup
(
pCfg
);
return
-
1
;
}
if
(
dmnLoadCfg
(
pCfg
,
cfgDir
,
envFile
,
apolloUrl
)
!=
0
)
{
uError
(
"failed to load log cfg since %s
\n
"
,
terrstr
());
printf
(
"failed to load log cfg since %s
\n
"
,
terrstr
());
cfgCleanup
(
pCfg
);
return
-
1
;
}
char
temp
[
PATH_MAX
]
=
{
0
};
snprintf
(
temp
,
PATH_MAX
,
"%s"
TD_DIRSEP
"taosdlog"
,
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
);
if
(
taosInitLog
(
temp
,
cfgGetItem
(
pCfg
,
"numOfLogLines"
)
->
i32
,
1
)
!=
0
)
{
uError
(
"failed to init log file since %s
\n
"
,
terrstr
());
if
(
dmnSetLogCfg
(
pCfg
)
!=
0
)
{
printf
(
"failed to set log cfg since %s
\n
"
,
terrstr
());
cfgCleanup
(
pCfg
);
return
-
1
;
}
if
(
taosInitLog
(
"taosdlog"
,
1
)
!=
0
)
{
printf
(
"failed to init log file since %s
\n
"
,
terrstr
());
cfgCleanup
(
pCfg
);
return
-
1
;
}
...
...
@@ -65,3 +96,35 @@ int32_t dmnInitLog(const char *cfgDir, const char *envFile, const char *apolloUr
cfgCleanup
(
pCfg
);
return
0
;
}
int32_t
dmnLoadCfg
(
SConfig
*
pConfig
,
const
char
*
inputCfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
)
{
char
configDir
[
PATH_MAX
]
=
{
0
};
char
configFile
[
PATH_MAX
+
100
]
=
{
0
};
taosExpandDir
(
inputCfgDir
,
configDir
,
PATH_MAX
);
snprintf
(
configFile
,
sizeof
(
configFile
),
"%s"
TD_DIRSEP
"taos.cfg"
,
configDir
);
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_APOLLO_URL
,
apolloUrl
)
!=
0
)
{
uError
(
"failed to load from apollo url:%s since %s
\n
"
,
apolloUrl
,
terrstr
());
return
-
1
;
}
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_CFG_FILE
,
configFile
)
!=
0
)
{
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_CFG_FILE
,
configDir
)
!=
0
)
{
uError
(
"failed to load from config file:%s since %s
\n
"
,
configFile
,
terrstr
());
return
-
1
;
}
}
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_ENV_FILE
,
envFile
)
!=
0
)
{
uError
(
"failed to load from env file:%s since %s
\n
"
,
envFile
,
terrstr
());
return
-
1
;
}
if
(
cfgLoad
(
pConfig
,
CFG_STYPE_ENV_VAR
,
NULL
)
!=
0
)
{
uError
(
"failed to load from global env variables since %s
\n
"
,
terrstr
());
return
-
1
;
}
return
0
;
}
source/dnode/mgmt/daemon/src/dmnUtil.c
浏览文件 @
460f7890
...
...
@@ -22,7 +22,7 @@ void dmnGenerateGrant() {
#endif
}
void
dmnPrintVersion
(
SConfig
*
pCfg
)
{
void
dmnPrintVersion
()
{
#ifdef TD_ENTERPRISE
char
*
releaseName
=
"enterprise"
;
#else
...
...
source/dnode/mgmt/impl/test/sut/src/sut.cpp
浏览文件 @
460f7890
...
...
@@ -28,16 +28,12 @@ void Testbase::InitLog(const char* path) {
wDebugFlag
=
0
;
sDebugFlag
=
0
;
tsdbDebugFlag
=
0
;
cqDebugFlag
=
0
;
tscEmbeddedInUtil
=
1
;
tsAsyncLog
=
0
;
taosRemoveDir
(
path
);
taosMkDir
(
path
);
char
temp
[
PATH_MAX
];
snprintf
(
temp
,
PATH_MAX
,
"%s/taosdlog"
,
path
);
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
1
)
!=
0
)
{
if
(
taosInitLog
(
"taosdlog"
,
1
)
!=
0
)
{
printf
(
"failed to init log file
\n
"
);
}
}
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
460f7890
...
...
@@ -131,9 +131,7 @@ void ctgTestInitLogFile() {
ctgDbgEnableDebug
(
"api"
);
char
temp
[
128
]
=
{
0
};
sprintf
(
temp
,
"%s/%s"
,
tsLogDir
,
defaultLogFileNamePrefix
);
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
maxLogFileNum
)
<
0
)
{
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
}
}
...
...
source/libs/config/src/config.c
浏览文件 @
460f7890
...
...
@@ -538,10 +538,7 @@ void cfgPrintCfg(SConfig *pCfg) {
}
int32_t
cfgCheck
(
SConfig
*
pConfig
)
{
SConfigItem
*
pItem
=
cfgGetItem
(
pConfig
,
"debugFlag"
);
if
(
pItem
!=
NULL
)
{
taosSetDebugFlag
(
pItem
->
i32
);
}
SConfigItem
*
pItem
=
NULL
;
pItem
=
cfgGetItem
(
pConfig
,
"localFqdn"
);
if
(
pItem
!=
NULL
)
{
...
...
source/libs/qworker/test/qworkerTests.cpp
浏览文件 @
460f7890
...
...
@@ -101,9 +101,7 @@ void qwtInitLogFile() {
tsAsyncLog
=
0
;
qDebugFlag
=
159
;
char
temp
[
128
]
=
{
0
};
sprintf
(
temp
,
"%s/%s"
,
tsLogDir
,
defaultLogFileNamePrefix
);
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
maxLogFileNum
)
<
0
)
{
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
}
...
...
source/libs/scheduler/test/schedulerTests.cpp
浏览文件 @
460f7890
...
...
@@ -66,9 +66,7 @@ void schtInitLogFile() {
tsAsyncLog
=
0
;
qDebugFlag
=
159
;
char
temp
[
128
]
=
{
0
};
sprintf
(
temp
,
"%s/%s"
,
tsLogDir
,
defaultLogFileNamePrefix
);
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
maxLogFileNum
)
<
0
)
{
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
}
...
...
source/libs/transport/test/pushClient.c
浏览文件 @
460f7890
...
...
@@ -192,7 +192,7 @@ int main(int argc, char *argv[]) {
}
}
taosInitLog
(
"client.log"
,
10
0000
,
10
);
taosInitLog
(
"client.log"
,
10
);
void
*
pRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pRpc
==
NULL
)
{
...
...
source/libs/transport/test/pushServer.c
浏览文件 @
460f7890
...
...
@@ -169,7 +169,7 @@ int main(int argc, char *argv[]) {
tsAsyncLog
=
0
;
rpcInit
.
connType
=
TAOS_CONN_SERVER
;
taosInitLog
(
"server.log"
,
10
0000
,
10
);
taosInitLog
(
"server.log"
,
10
);
void
*
pRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pRpc
==
NULL
)
{
...
...
source/libs/transport/test/rclient.c
浏览文件 @
460f7890
...
...
@@ -169,7 +169,7 @@ int main(int argc, char *argv[]) {
}
}
taosInitLog
(
"client.log"
,
10
0000
,
10
);
taosInitLog
(
"client.log"
,
10
);
void
*
pRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pRpc
==
NULL
)
{
...
...
source/libs/transport/test/rsclient.c
浏览文件 @
460f7890
...
...
@@ -148,7 +148,7 @@ int main(int argc, char *argv[]) {
}
}
taosInitLog
(
"client.log"
,
10
0000
,
10
);
taosInitLog
(
"client.log"
,
10
);
void
*
pRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pRpc
==
NULL
)
{
...
...
source/libs/transport/test/rserver.c
浏览文件 @
460f7890
...
...
@@ -158,7 +158,7 @@ int main(int argc, char *argv[]) {
tsAsyncLog
=
0
;
rpcInit
.
connType
=
TAOS_CONN_SERVER
;
taosInitLog
(
"server.log"
,
10
0000
,
10
);
taosInitLog
(
"server.log"
,
10
);
void
*
pRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pRpc
==
NULL
)
{
...
...
source/libs/transport/test/syncClient.c
浏览文件 @
460f7890
...
...
@@ -170,7 +170,7 @@ int main(int argc, char *argv[]) {
}
}
taosInitLog
(
"client.log"
,
10
0000
,
10
);
taosInitLog
(
"client.log"
,
10
);
void
*
pRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pRpc
==
NULL
)
{
...
...
source/util/src/tlog.c
浏览文件 @
460f7890
...
...
@@ -70,7 +70,7 @@ typedef struct {
int8_t
tscEmbeddedInUtil
=
0
;
int32_t
tsLogKeepDays
=
0
;
int8_t
tsAsyncLog
=
1
;
bool
tsAsyncLog
=
true
;
float
tsTotalLogDirGB
=
0
;
float
tsAvailLogDirGB
=
0
;
float
tsMinimalLogDirGB
=
1
.
0
f
;
...
...
@@ -79,20 +79,19 @@ int32_t writeInterval = DEFAULT_LOG_INTERVAL;
// log
int32_t
tsNumOfLogLines
=
10000000
;
int32_t
mDebugFlag
=
131
;
int32_t
dDebugFlag
=
135
;
int32_t
vDebugFlag
=
135
;
int32_t
mDebugFlag
=
131
;
int32_t
cDebugFlag
=
131
;
int32_t
jniDebugFlag
=
131
;
int32_t
qDebugFlag
=
131
;
int32_t
rpcDebugFlag
=
131
;
int32_t
tmrDebugFlag
=
131
;
int32_t
uDebugFlag
=
131
;
int32_t
debugFlag
=
0
;
int32_t
sDebugFlag
=
135
;
int32_t
rpcDebugFlag
=
131
;
int32_t
qDebugFlag
=
131
;
int32_t
wDebugFlag
=
135
;
int32_t
sDebugFlag
=
135
;
int32_t
tsdbDebugFlag
=
131
;
int32_t
tqDebugFlag
=
135
;
int32_t
cqDebugFlag
=
131
;
int32_t
fsDebugFlag
=
135
;
int64_t
dbgEmptyW
=
0
;
...
...
@@ -120,10 +119,13 @@ static int32_t taosStartLog() {
return
0
;
}
int32_t
taosInitLog
(
char
*
logName
,
int
numOfLogLines
,
int
maxFiles
)
{
int32_t
taosInitLog
(
const
char
*
logName
,
int
maxFiles
)
{
char
fullName
[
PATH_MAX
]
=
{
0
};
snprintf
(
fullName
,
PATH_MAX
,
"%s"
TD_DIRSEP
"%s"
,
tsLogDir
,
logName
);
tsLogObj
.
logHandle
=
taosLogBuffNew
(
TSDB_DEFAULT_LOG_BUF_SIZE
);
if
(
tsLogObj
.
logHandle
==
NULL
)
return
-
1
;
if
(
taosOpenLogFile
(
logName
,
n
umOfLogLines
,
maxFiles
)
<
0
)
return
-
1
;
if
(
taosOpenLogFile
(
fullName
,
tsN
umOfLogLines
,
maxFiles
)
<
0
)
return
-
1
;
if
(
taosStartLog
()
<
0
)
return
-
1
;
return
0
;
}
...
...
@@ -774,11 +776,22 @@ void taosPrintOsInfo() {
uInfo
(
" os machine: %s"
,
info
.
machine
);
}
void
taosSetDebugFlag
(
int32_t
flag
)
{
if
(
!
(
debugFlag
&
DEBUG_TRACE
||
debugFlag
&
DEBUG_DEBUG
||
debugF
lag
&
DEBUG_DUMP
))
return
;
void
taosSet
All
DebugFlag
(
int32_t
flag
)
{
if
(
!
(
flag
&
DEBUG_TRACE
||
flag
&
DEBUG_DEBUG
||
f
lag
&
DEBUG_DUMP
))
return
;
debugFlag
=
flag
;
mDebugFlag
=
flag
;
dDebugFlag
=
flag
;
vDebugFlag
=
flag
;
mDebugFlag
=
flag
;
cDebugFlag
=
flag
;
jniDebugFlag
=
flag
;
uDebugFlag
=
flag
;
rpcDebugFlag
=
flag
;
qDebugFlag
=
flag
;
wDebugFlag
=
flag
;
sDebugFlag
=
flag
;
tsdbDebugFlag
=
flag
;
tqDebugFlag
=
flag
;
fsDebugFlag
=
flag
;
uInfo
(
"all debug flag are set to %d"
,
flag
);
}
\ No newline at end of file
source/util/src/ttimer.c
浏览文件 @
460f7890
...
...
@@ -81,7 +81,6 @@ typedef struct time_wheel_t {
tmr_obj_t
**
slots
;
}
time_wheel_t
;
int32_t
tmrDebugFlag
=
131
;
uint32_t
tsMaxTmrCtrl
=
512
;
static
pthread_once_t
tmrModuleInit
=
PTHREAD_ONCE_INIT
;
...
...
source/util/test/trefTest.c
浏览文件 @
460f7890
...
...
@@ -158,7 +158,7 @@ int main(int argc, char *argv[]) {
}
}
taosInitLog
(
"tref.log"
,
5000000
,
10
);
taosInitLog
(
"tref.log"
,
10
);
SRefSpace
*
pSpaceList
=
(
SRefSpace
*
)
calloc
(
sizeof
(
SRefSpace
),
threads
);
pthread_t
*
pThreadList
=
(
pthread_t
*
)
calloc
(
sizeof
(
pthread_t
),
threads
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录