fix: refactor logdebugs
This commit is contained in:
parent
4dc31987a4
commit
de631e20a5
|
@ -228,8 +228,8 @@ int32_t taosCfgDynamicOptions(SConfig *pCfg, char *name, bool forServer);
|
||||||
|
|
||||||
struct SConfig *taosGetCfg();
|
struct SConfig *taosGetCfg();
|
||||||
|
|
||||||
void taosSetAllDebugFlag(int32_t flag, bool rewrite);
|
void taosSetAllDebugFlag(int32_t flag);
|
||||||
void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal, bool rewrite);
|
void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal);
|
||||||
void taosLocalCfgForbiddenToChange(char *name, bool *forbidden);
|
void taosLocalCfgForbiddenToChange(char *name, bool *forbidden);
|
||||||
int8_t taosGranted();
|
int8_t taosGranted();
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ typedef struct SConfigItem {
|
||||||
int64_t imax;
|
int64_t imax;
|
||||||
double fmax;
|
double fmax;
|
||||||
};
|
};
|
||||||
SArray *array; // SDiskCfg
|
SArray *array; // SDiskCfg/SLogVar
|
||||||
} SConfigItem;
|
} SConfigItem;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -260,7 +260,7 @@ typedef enum ELogicConditionType {
|
||||||
#define TSDB_PASSWORD_LEN 32
|
#define TSDB_PASSWORD_LEN 32
|
||||||
#define TSDB_USET_PASSWORD_LEN 129
|
#define TSDB_USET_PASSWORD_LEN 129
|
||||||
#define TSDB_VERSION_LEN 32
|
#define TSDB_VERSION_LEN 32
|
||||||
#define TSDB_LABEL_LEN 12
|
#define TSDB_LABEL_LEN 12
|
||||||
#define TSDB_JOB_STATUS_LEN 32
|
#define TSDB_JOB_STATUS_LEN 32
|
||||||
|
|
||||||
#define TSDB_CLUSTER_ID_LEN 40
|
#define TSDB_CLUSTER_ID_LEN 40
|
||||||
|
@ -272,6 +272,7 @@ typedef enum ELogicConditionType {
|
||||||
#define TSDB_SHOW_SCHEMA_JSON_LEN TSDB_MAX_COLUMNS * 256
|
#define TSDB_SHOW_SCHEMA_JSON_LEN TSDB_MAX_COLUMNS * 256
|
||||||
#define TSDB_SLOW_QUERY_SQL_LEN 512
|
#define TSDB_SLOW_QUERY_SQL_LEN 512
|
||||||
#define TSDB_SHOW_SUBQUERY_LEN 1000
|
#define TSDB_SHOW_SUBQUERY_LEN 1000
|
||||||
|
#define TSDB_LOG_VAR_LEN 32
|
||||||
|
|
||||||
#define TSDB_TRANS_STAGE_LEN 12
|
#define TSDB_TRANS_STAGE_LEN 12
|
||||||
#define TSDB_TRANS_TYPE_LEN 16
|
#define TSDB_TRANS_TYPE_LEN 16
|
||||||
|
@ -503,6 +504,10 @@ typedef struct {
|
||||||
int32_t primary;
|
int32_t primary;
|
||||||
} SDiskCfg;
|
} SDiskCfg;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char name[TSDB_LOG_VAR_LEN];
|
||||||
|
} SLogVar;
|
||||||
|
|
||||||
#define TMQ_SEPARATOR ':'
|
#define TMQ_SEPARATOR ':'
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -67,6 +67,7 @@ extern int32_t smaDebugFlag;
|
||||||
extern int32_t idxDebugFlag;
|
extern int32_t idxDebugFlag;
|
||||||
extern int32_t tdbDebugFlag;
|
extern int32_t tdbDebugFlag;
|
||||||
extern int32_t sndDebugFlag;
|
extern int32_t sndDebugFlag;
|
||||||
|
extern int32_t simDebugFlag;
|
||||||
|
|
||||||
int32_t taosInitLog(const char *logName, int32_t maxFiles);
|
int32_t taosInitLog(const char *logName, int32_t maxFiles);
|
||||||
void taosCloseLog();
|
void taosCloseLog();
|
||||||
|
|
|
@ -423,7 +423,7 @@ int32_t taosAddClientLogCfg(SConfig *pCfg) {
|
||||||
if (cfgAddBool(pCfg, "asyncLog", tsAsyncLog, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
|
if (cfgAddBool(pCfg, "asyncLog", tsAsyncLog, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "logKeepDays", 0, -365000, 365000, CFG_SCOPE_BOTH, CFG_DYN_ENT_BOTH) != 0) return -1;
|
if (cfgAddInt32(pCfg, "logKeepDays", 0, -365000, 365000, CFG_SCOPE_BOTH, CFG_DYN_ENT_BOTH) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "debugFlag", 0, 0, 255, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
|
if (cfgAddInt32(pCfg, "debugFlag", 0, 0, 255, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "simDebugFlag", 143, 0, 255, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
if (cfgAddInt32(pCfg, "simDebugFlag", simDebugFlag, 0, 255, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "tmrDebugFlag", tmrDebugFlag, 0, 255, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
|
if (cfgAddInt32(pCfg, "tmrDebugFlag", tmrDebugFlag, 0, 255, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "uDebugFlag", uDebugFlag, 0, 255, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
|
if (cfgAddInt32(pCfg, "uDebugFlag", uDebugFlag, 0, 255, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "rpcDebugFlag", rpcDebugFlag, 0, 255, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
|
if (cfgAddInt32(pCfg, "rpcDebugFlag", rpcDebugFlag, 0, 255, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1;
|
||||||
|
@ -497,7 +497,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
|
||||||
if (cfgAddInt32(pCfg, "maxRetryWaitTime", tsMaxRetryWaitTime, 0, 86400000, CFG_SCOPE_BOTH, CFG_DYN_CLIENT) != 0)
|
if (cfgAddInt32(pCfg, "maxRetryWaitTime", tsMaxRetryWaitTime, 0, 86400000, CFG_SCOPE_BOTH, CFG_DYN_CLIENT) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1;
|
if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1;
|
||||||
if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, CFG_SCOPE_SERVER, CFG_DYN_CLIENT) != 0) return -1;
|
if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1;
|
||||||
if (cfgAddInt64(pCfg, "queryMaxConcurrentTables", tsQueryMaxConcurrentTables, INT64_MIN, INT64_MAX, CFG_SCOPE_CLIENT,
|
if (cfgAddInt64(pCfg, "queryMaxConcurrentTables", tsQueryMaxConcurrentTables, INT64_MIN, INT64_MAX, CFG_SCOPE_CLIENT,
|
||||||
CFG_DYN_NONE) != 0)
|
CFG_DYN_NONE) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -962,6 +962,7 @@ static void taosSetClientLogCfg(SConfig *pCfg) {
|
||||||
rpcDebugFlag = cfgGetItem(pCfg, "rpcDebugFlag")->i32;
|
rpcDebugFlag = cfgGetItem(pCfg, "rpcDebugFlag")->i32;
|
||||||
qDebugFlag = cfgGetItem(pCfg, "qDebugFlag")->i32;
|
qDebugFlag = cfgGetItem(pCfg, "qDebugFlag")->i32;
|
||||||
cDebugFlag = cfgGetItem(pCfg, "cDebugFlag")->i32;
|
cDebugFlag = cfgGetItem(pCfg, "cDebugFlag")->i32;
|
||||||
|
simDebugFlag = cfgGetItem(pCfg, "simDebugFlag")->i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void taosSetServerLogCfg(SConfig *pCfg) {
|
static void taosSetServerLogCfg(SConfig *pCfg) {
|
||||||
|
@ -1278,7 +1279,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
|
||||||
taosSetServerLogCfg(pCfg);
|
taosSetServerLogCfg(pCfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosSetAllDebugFlag(cfgGetItem(pCfg, "debugFlag")->i32, false);
|
taosSetAllDebugFlag(cfgGetItem(pCfg, "debugFlag")->i32);
|
||||||
|
|
||||||
if (taosMulModeMkDir(tsLogDir, 0777, true) != 0) {
|
if (taosMulModeMkDir(tsLogDir, 0777, true) != 0) {
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
@ -1356,6 +1357,8 @@ int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile
|
||||||
taosSetSystemCfg(tsCfg);
|
taosSetSystemCfg(tsCfg);
|
||||||
if (taosSetFileHandlesLimit() != 0) return -1;
|
if (taosSetFileHandlesLimit() != 0) return -1;
|
||||||
|
|
||||||
|
taosSetAllDebugFlag(cfgGetItem(tsCfg, "debugFlag")->i32);
|
||||||
|
|
||||||
cfgDumpCfg(tsCfg, tsc, false);
|
cfgDumpCfg(tsCfg, tsc, false);
|
||||||
|
|
||||||
if (taosCheckGlobalCfg() != 0) {
|
if (taosCheckGlobalCfg() != 0) {
|
||||||
|
@ -1399,7 +1402,7 @@ static int32_t taosCfgSetOption(OptionNameAndVar *pOptions, int32_t optionSize,
|
||||||
*pVar = flag;
|
*pVar = flag;
|
||||||
|
|
||||||
if (isDebugflag) {
|
if (isDebugflag) {
|
||||||
taosSetDebugFlag(pOptions[d].optionVar, optName, flag, true);
|
taosSetDebugFlag(pOptions[d].optionVar, optName, flag);
|
||||||
}
|
}
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
} break;
|
} break;
|
||||||
|
@ -1447,8 +1450,7 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, char *name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncasecmp(name, "debugFlag", 9) == 0) {
|
if (strncasecmp(name, "debugFlag", 9) == 0) {
|
||||||
int32_t flag = pItem->i32;
|
taosSetAllDebugFlag(pItem->i32);
|
||||||
taosSetAllDebugFlag(flag, true);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1460,7 +1462,7 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, char *name) {
|
||||||
{"smaDebugFlag", &smaDebugFlag}, {"idxDebugFlag", &idxDebugFlag}, {"tdbDebugFlag", &tdbDebugFlag},
|
{"smaDebugFlag", &smaDebugFlag}, {"idxDebugFlag", &idxDebugFlag}, {"tdbDebugFlag", &tdbDebugFlag},
|
||||||
{"tmrDebugFlag", &tmrDebugFlag}, {"uDebugFlag", &uDebugFlag}, {"smaDebugFlag", &smaDebugFlag},
|
{"tmrDebugFlag", &tmrDebugFlag}, {"uDebugFlag", &uDebugFlag}, {"smaDebugFlag", &smaDebugFlag},
|
||||||
{"rpcDebugFlag", &rpcDebugFlag}, {"qDebugFlag", &qDebugFlag}, {"metaDebugFlag", &metaDebugFlag},
|
{"rpcDebugFlag", &rpcDebugFlag}, {"qDebugFlag", &qDebugFlag}, {"metaDebugFlag", &metaDebugFlag},
|
||||||
{"jniDebugFlag", &jniDebugFlag}, {"stDebugFlag", &stDebugFlag}, {"sndDebugFlag", &sndDebugFlag},
|
{"stDebugFlag", &stDebugFlag}, {"sndDebugFlag", &sndDebugFlag},
|
||||||
};
|
};
|
||||||
|
|
||||||
static OptionNameAndVar options[] = {
|
static OptionNameAndVar options[] = {
|
||||||
|
@ -1524,8 +1526,7 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, char *name) {
|
||||||
switch (lowcaseName[0]) {
|
switch (lowcaseName[0]) {
|
||||||
case 'd': {
|
case 'd': {
|
||||||
if (strcasecmp("debugFlag", name) == 0) {
|
if (strcasecmp("debugFlag", name) == 0) {
|
||||||
int32_t flag = pItem->i32;
|
taosSetAllDebugFlag(pItem->i32);
|
||||||
taosSetAllDebugFlag(flag, true);
|
|
||||||
matched = true;
|
matched = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1691,7 +1692,7 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, char *name) {
|
||||||
{"cDebugFlag", &cDebugFlag}, {"dDebugFlag", &dDebugFlag}, {"fsDebugFlag", &fsDebugFlag},
|
{"cDebugFlag", &cDebugFlag}, {"dDebugFlag", &dDebugFlag}, {"fsDebugFlag", &fsDebugFlag},
|
||||||
{"idxDebugFlag", &idxDebugFlag}, {"jniDebugFlag", &jniDebugFlag}, {"qDebugFlag", &qDebugFlag},
|
{"idxDebugFlag", &idxDebugFlag}, {"jniDebugFlag", &jniDebugFlag}, {"qDebugFlag", &qDebugFlag},
|
||||||
{"rpcDebugFlag", &rpcDebugFlag}, {"smaDebugFlag", &smaDebugFlag}, {"tmrDebugFlag", &tmrDebugFlag},
|
{"rpcDebugFlag", &rpcDebugFlag}, {"smaDebugFlag", &smaDebugFlag}, {"tmrDebugFlag", &tmrDebugFlag},
|
||||||
{"uDebugFlag", &uDebugFlag},
|
{"uDebugFlag", &uDebugFlag}, {"simDebugFlag", &simDebugFlag},
|
||||||
};
|
};
|
||||||
|
|
||||||
static OptionNameAndVar options[] = {
|
static OptionNameAndVar options[] = {
|
||||||
|
@ -1736,9 +1737,9 @@ int32_t taosCfgDynamicOptions(SConfig *pCfg, char *name, bool forServer) {
|
||||||
return taosCfgDynamicOptionsForClient(pCfg, name);
|
return taosCfgDynamicOptionsForClient(pCfg, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal, bool rewrite) {
|
void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal) {
|
||||||
SConfigItem *pItem = cfgGetItem(tsCfg, flagName);
|
SConfigItem *pItem = cfgGetItem(tsCfg, flagName);
|
||||||
if (pItem != NULL && (rewrite || pItem->i32 == 0)) {
|
if (pItem != NULL) {
|
||||||
pItem->i32 = flagVal;
|
pItem->i32 = flagVal;
|
||||||
}
|
}
|
||||||
if (pFlagPtr != NULL) {
|
if (pFlagPtr != NULL) {
|
||||||
|
@ -1746,33 +1747,58 @@ void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosSetAllDebugFlag(int32_t flag, bool rewrite) {
|
static int taosLogVarComp(void const *lp, void const *rp) {
|
||||||
|
SLogVar *lpVar = (SLogVar *)lp;
|
||||||
|
SLogVar *rpVar = (SLogVar *)rp;
|
||||||
|
return strcasecmp(lpVar->name, rpVar->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void taosCheckAndSetDebugFlag(int32_t *pFlagPtr, char *name, int32_t flag, SArray *noNeedToSetVars) {
|
||||||
|
if (noNeedToSetVars != NULL && taosArraySearch(noNeedToSetVars, name, taosLogVarComp, TD_EQ) != NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
taosSetDebugFlag(pFlagPtr, name, flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void taosSetAllDebugFlag(int32_t flag) {
|
||||||
if (flag <= 0) return;
|
if (flag <= 0) return;
|
||||||
|
|
||||||
taosSetDebugFlag(NULL, "debugFlag", flag, rewrite);
|
SArray *noNeedToSetVars = NULL;
|
||||||
taosSetDebugFlag(NULL, "simDebugFlag", flag, rewrite);
|
SConfigItem *pItem = cfgGetItem(tsCfg, "debugFlag");
|
||||||
taosSetDebugFlag(NULL, "tmrDebugFlag", flag, rewrite);
|
if (pItem != NULL) {
|
||||||
taosSetDebugFlag(&uDebugFlag, "uDebugFlag", flag, rewrite);
|
pItem->i32 = flag;
|
||||||
taosSetDebugFlag(&rpcDebugFlag, "rpcDebugFlag", flag, rewrite);
|
noNeedToSetVars = pItem->array;
|
||||||
taosSetDebugFlag(&jniDebugFlag, "jniDebugFlag", flag, rewrite);
|
}
|
||||||
taosSetDebugFlag(&qDebugFlag, "qDebugFlag", flag, rewrite);
|
|
||||||
taosSetDebugFlag(&cDebugFlag, "cDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&simDebugFlag, "simDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&dDebugFlag, "dDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&tmrDebugFlag, "tmrDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&vDebugFlag, "vDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&uDebugFlag, "uDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&mDebugFlag, "mDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&rpcDebugFlag, "rpcDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&wDebugFlag, "wDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&qDebugFlag, "qDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&sDebugFlag, "sDebugFlag", flag, rewrite);
|
|
||||||
taosSetDebugFlag(&tsdbDebugFlag, "tsdbDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&jniDebugFlag, "jniDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&tqDebugFlag, "tqDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&cDebugFlag, "cDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&fsDebugFlag, "fsDebugFlag", flag, rewrite);
|
|
||||||
taosSetDebugFlag(&udfDebugFlag, "udfDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&dDebugFlag, "dDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&smaDebugFlag, "smaDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&vDebugFlag, "vDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&idxDebugFlag, "idxDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&mDebugFlag, "mDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&tdbDebugFlag, "tdbDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&wDebugFlag, "wDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&metaDebugFlag, "metaDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&sDebugFlag, "sDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&stDebugFlag, "stDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&tsdbDebugFlag, "tsdbDebugFlag", flag, noNeedToSetVars);
|
||||||
taosSetDebugFlag(&sndDebugFlag, "sndDebugFlag", flag, rewrite);
|
taosCheckAndSetDebugFlag(&tqDebugFlag, "tqDebugFlag", flag, noNeedToSetVars);
|
||||||
|
taosCheckAndSetDebugFlag(&fsDebugFlag, "fsDebugFlag", flag, noNeedToSetVars);
|
||||||
|
taosCheckAndSetDebugFlag(&udfDebugFlag, "udfDebugFlag", flag, noNeedToSetVars);
|
||||||
|
taosCheckAndSetDebugFlag(&smaDebugFlag, "smaDebugFlag", flag, noNeedToSetVars);
|
||||||
|
taosCheckAndSetDebugFlag(&idxDebugFlag, "idxDebugFlag", flag, noNeedToSetVars);
|
||||||
|
taosCheckAndSetDebugFlag(&tdbDebugFlag, "tdbDebugFlag", flag, noNeedToSetVars);
|
||||||
|
taosCheckAndSetDebugFlag(&metaDebugFlag, "metaDebugFlag", flag, noNeedToSetVars);
|
||||||
|
taosCheckAndSetDebugFlag(&stDebugFlag, "stDebugFlag", flag, noNeedToSetVars);
|
||||||
|
taosCheckAndSetDebugFlag(&sndDebugFlag, "sndDebugFlag", flag, noNeedToSetVars);
|
||||||
|
|
||||||
|
taosArrayClear(noNeedToSetVars); // reset array
|
||||||
|
|
||||||
uInfo("all debug flag are set to %d", flag);
|
uInfo("all debug flag are set to %d", flag);
|
||||||
|
if (terrno == TSDB_CODE_CFG_NOT_FOUND) terrno = TSDB_CODE_SUCCESS; // ignore not exist
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t taosGranted() { return atomic_load_8(&tsGrant); }
|
int8_t taosGranted() { return atomic_load_8(&tsGrant); }
|
||||||
|
|
|
@ -68,7 +68,7 @@ static struct {
|
||||||
int64_t startTime;
|
int64_t startTime;
|
||||||
} global = {0};
|
} global = {0};
|
||||||
|
|
||||||
static void dmSetDebugFlag(int32_t signum, void *sigInfo, void *context) { taosSetAllDebugFlag(143, true); }
|
static void dmSetDebugFlag(int32_t signum, void *sigInfo, void *context) { taosSetAllDebugFlag(143); }
|
||||||
static void dmSetAssert(int32_t signum, void *sigInfo, void *context) { tsAssert = 1; }
|
static void dmSetAssert(int32_t signum, void *sigInfo, void *context) { tsAssert = 1; }
|
||||||
|
|
||||||
static void dmStopDnode(int signum, void *sigInfo, void *context) {
|
static void dmStopDnode(int signum, void *sigInfo, void *context) {
|
||||||
|
|
|
@ -307,6 +307,34 @@ static int32_t cfgSetTfsItem(SConfig *pCfg, const char *name, const char *value,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t cfgUpdateDebugFlagItem(SConfig *pCfg, const char *name, bool resetArray) {
|
||||||
|
SConfigItem *pDebugFlagItem = cfgGetItem(pCfg, "debugFlag");
|
||||||
|
if (resetArray) {
|
||||||
|
// reset
|
||||||
|
if (pDebugFlagItem == NULL) return -1;
|
||||||
|
|
||||||
|
// logflag names that should 'not' be set by 'debugFlag'
|
||||||
|
if (pDebugFlagItem->array == NULL) {
|
||||||
|
pDebugFlagItem->array = taosArrayInit(16, sizeof(SLogVar));
|
||||||
|
if (pDebugFlagItem->array == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
taosArrayClear(pDebugFlagItem->array);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update
|
||||||
|
if (pDebugFlagItem == NULL) return -1;
|
||||||
|
if (pDebugFlagItem->array != NULL) {
|
||||||
|
SLogVar logVar = {0};
|
||||||
|
strncpy(logVar.name, name, TSDB_LOG_VAR_LEN - 1);
|
||||||
|
taosArrayPush(pDebugFlagItem->array, &logVar);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t cfgSetItem(SConfig *pCfg, const char *name, const char *value, ECfgSrcType stype) {
|
int32_t cfgSetItem(SConfig *pCfg, const char *name, const char *value, ECfgSrcType stype) {
|
||||||
GRANT_CFG_SET;
|
GRANT_CFG_SET;
|
||||||
SConfigItem *pItem = cfgGetItem(pCfg, name);
|
SConfigItem *pItem = cfgGetItem(pCfg, name);
|
||||||
|
@ -661,7 +689,6 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) {
|
||||||
SConfigItem *pItem = taosArrayGet(pCfg->array, i);
|
SConfigItem *pItem = taosArrayGet(pCfg->array, i);
|
||||||
if (tsc && pItem->scope == CFG_SCOPE_SERVER) continue;
|
if (tsc && pItem->scope == CFG_SCOPE_SERVER) continue;
|
||||||
if (dump && strcmp(pItem->name, "scriptDir") == 0) continue;
|
if (dump && strcmp(pItem->name, "scriptDir") == 0) continue;
|
||||||
if (dump && strcmp(pItem->name, "simDebugFlag") == 0) continue;
|
|
||||||
tstrncpy(src, cfgStypeStr(pItem->stype), CFG_SRC_PRINT_LEN);
|
tstrncpy(src, cfgStypeStr(pItem->stype), CFG_SRC_PRINT_LEN);
|
||||||
for (int32_t j = 0; j < CFG_SRC_PRINT_LEN; ++j) {
|
for (int32_t j = 0; j < CFG_SRC_PRINT_LEN; ++j) {
|
||||||
if (src[j] == 0) src[j] = ' ';
|
if (src[j] == 0) src[j] = ' ';
|
||||||
|
@ -931,6 +958,14 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) {
|
||||||
code = cfgSetTfsItem(pConfig, name, value, value2, value3, CFG_STYPE_CFG_FILE);
|
code = cfgSetTfsItem(pConfig, name, value, value2, value3, CFG_STYPE_CFG_FILE);
|
||||||
if (code != 0 && terrno != TSDB_CODE_CFG_NOT_FOUND) break;
|
if (code != 0 && terrno != TSDB_CODE_CFG_NOT_FOUND) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t len = strlen(name);
|
||||||
|
const char *debugFlagStr = "debugFlag";
|
||||||
|
const size_t debugFlagLen = strlen(debugFlagStr);
|
||||||
|
if (len >= debugFlagLen && strcasecmp(name + len - debugFlagLen, debugFlagStr) == 0) {
|
||||||
|
code = cfgUpdateDebugFlagItem(pConfig, name, len == debugFlagLen);
|
||||||
|
if (code != 0 && terrno != TSDB_CODE_CFG_NOT_FOUND) break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
taosCloseFile(&pFile);
|
taosCloseFile(&pFile);
|
||||||
|
|
|
@ -111,6 +111,7 @@ int32_t udfDebugFlag = 131;
|
||||||
int32_t smaDebugFlag = 131;
|
int32_t smaDebugFlag = 131;
|
||||||
int32_t idxDebugFlag = 131;
|
int32_t idxDebugFlag = 131;
|
||||||
int32_t sndDebugFlag = 131;
|
int32_t sndDebugFlag = 131;
|
||||||
|
int32_t simDebugFlag = 131;
|
||||||
|
|
||||||
int64_t dbgEmptyW = 0;
|
int64_t dbgEmptyW = 0;
|
||||||
int64_t dbgWN = 0;
|
int64_t dbgWN = 0;
|
||||||
|
|
|
@ -184,7 +184,6 @@ extern SScript *simScriptList[MAX_MAIN_SCRIPT_NUM];
|
||||||
extern SCommand simCmdList[];
|
extern SCommand simCmdList[];
|
||||||
extern int32_t simScriptPos;
|
extern int32_t simScriptPos;
|
||||||
extern int32_t simScriptSucceed;
|
extern int32_t simScriptSucceed;
|
||||||
extern int32_t simDebugFlag;
|
|
||||||
extern char simScriptDir[];
|
extern char simScriptDir[];
|
||||||
extern bool abortExecution;
|
extern bool abortExecution;
|
||||||
extern bool useValgrind;
|
extern bool useValgrind;
|
||||||
|
|
|
@ -21,7 +21,6 @@ SScript *simScriptList[MAX_MAIN_SCRIPT_NUM];
|
||||||
SCommand simCmdList[SIM_CMD_END];
|
SCommand simCmdList[SIM_CMD_END];
|
||||||
int32_t simScriptPos = -1;
|
int32_t simScriptPos = -1;
|
||||||
int32_t simScriptSucceed = 0;
|
int32_t simScriptSucceed = 0;
|
||||||
int32_t simDebugFlag = 143;
|
|
||||||
void simCloseTaosdConnect(SScript *script);
|
void simCloseTaosdConnect(SScript *script);
|
||||||
char simScriptDir[PATH_MAX] = {0};
|
char simScriptDir[PATH_MAX] = {0};
|
||||||
|
|
||||||
|
@ -32,7 +31,6 @@ int32_t simInitCfg() {
|
||||||
taosInitCfg(configDir, NULL, NULL, NULL, NULL, 1);
|
taosInitCfg(configDir, NULL, NULL, NULL, NULL, 1);
|
||||||
|
|
||||||
SConfig *pCfg = taosGetCfg();
|
SConfig *pCfg = taosGetCfg();
|
||||||
simDebugFlag = cfgGetItem(pCfg, "simDebugFlag")->i32;
|
|
||||||
tstrncpy(simScriptDir, cfgGetItem(pCfg, "scriptDir")->str, PATH_MAX);
|
tstrncpy(simScriptDir, cfgGetItem(pCfg, "scriptDir")->str, PATH_MAX);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue