Merge pull request #27505 from taosdata/fix/TD-31742-3.0

fix: (cfg) dynamic update for enableCoreFile
This commit is contained in:
Hongze Cheng 2024-08-28 11:28:51 +08:00 committed by GitHub
commit 29680962f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 12 deletions

View File

@ -971,10 +971,6 @@ void taos_init_imp(void) {
tscDebug("starting to initialize TAOS driver"); tscDebug("starting to initialize TAOS driver");
#ifndef WINDOWS
taosSetCoreDump(true);
#endif
ENV_ERR_RET(initTaskQueue(), "failed to init task queue"); ENV_ERR_RET(initTaskQueue(), "failed to init task queue");
ENV_ERR_RET(fmFuncMgtInit(), "failed to init funcMgt"); ENV_ERR_RET(fmFuncMgtInit(), "failed to init funcMgt");
ENV_ERR_RET(nodesInitAllocatorSet(), "failed to init allocator set"); ENV_ERR_RET(nodesInitAllocatorSet(), "failed to init allocator set");

View File

@ -638,7 +638,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
TAOS_CHECK_RETURN(cfgAddLocale(pCfg, "locale", tsLocale, CFG_SCOPE_BOTH, CFG_DYN_CLIENT)); TAOS_CHECK_RETURN(cfgAddLocale(pCfg, "locale", tsLocale, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
TAOS_CHECK_RETURN(cfgAddCharset(pCfg, "charset", tsCharset, CFG_SCOPE_BOTH, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddCharset(pCfg, "charset", tsCharset, CFG_SCOPE_BOTH, CFG_DYN_NONE));
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "assert", tsAssert, CFG_SCOPE_BOTH, CFG_DYN_CLIENT)); TAOS_CHECK_RETURN(cfgAddBool(pCfg, "assert", tsAssert, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableCoreFile", 1, CFG_SCOPE_BOTH, CFG_DYN_CLIENT)); TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableCoreFile", tsEnableCoreFile, CFG_SCOPE_BOTH, CFG_DYN_BOTH));
TAOS_CHECK_RETURN(cfgAddFloat(pCfg, "numOfCores", tsNumOfCores, 1, 100000, CFG_SCOPE_BOTH, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddFloat(pCfg, "numOfCores", tsNumOfCores, 1, 100000, CFG_SCOPE_BOTH, CFG_DYN_NONE));
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "ssd42", tsSSE42Supported, CFG_SCOPE_BOTH, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddBool(pCfg, "ssd42", tsSSE42Supported, CFG_SCOPE_BOTH, CFG_DYN_NONE));
@ -1287,8 +1287,8 @@ static int32_t taosSetSystemCfg(SConfig *pCfg) {
osSetSystemLocale(locale, charset); osSetSystemLocale(locale, charset);
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "enableCoreFile"); TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "enableCoreFile");
bool enableCore = pItem->bval; tsEnableCoreFile = pItem->bval;
taosSetCoreDump(enableCore); taosSetCoreDump(tsEnableCoreFile);
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "assert"); TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "assert");
tsAssert = pItem->bval; tsAssert = pItem->bval;
@ -1901,6 +1901,13 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) {
goto _exit; goto _exit;
} }
if (strncasecmp(name, "enableCoreFile", 9) == 0) {
tsEnableCoreFile = pItem->bval;
taosSetCoreDump(tsEnableCoreFile);
uInfo("%s set to %d", name, tsEnableCoreFile);
goto _exit;
}
if (strcasecmp("slowLogScope", name) == 0) { if (strcasecmp("slowLogScope", name) == 0) {
int32_t scope = 0; int32_t scope = 0;
TAOS_CHECK_GOTO(taosSetSlowLogScope(pItem->str, &scope), NULL, _exit); TAOS_CHECK_GOTO(taosSetSlowLogScope(pItem->str, &scope), NULL, _exit);
@ -2009,9 +2016,9 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
} }
case 'e': { case 'e': {
if (strcasecmp("enableCoreFile", name) == 0) { if (strcasecmp("enableCoreFile", name) == 0) {
bool enableCore = pItem->bval; tsEnableCoreFile = pItem->bval;
taosSetCoreDump(enableCore); taosSetCoreDump(tsEnableCoreFile);
uInfo("%s set to %d", name, enableCore); uInfo("%s set to %d", name, tsEnableCoreFile);
matched = true; matched = true;
} }
break; break;
@ -2205,7 +2212,6 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
{"compressMsgSize", &tsCompressMsgSize}, {"compressMsgSize", &tsCompressMsgSize},
{"countAlwaysReturnValue", &tsCountAlwaysReturnValue}, {"countAlwaysReturnValue", &tsCountAlwaysReturnValue},
{"crashReporting", &tsEnableCrashReport}, {"crashReporting", &tsEnableCrashReport},
{"enableCoreFile", &tsAsyncLog},
{"enableQueryHb", &tsEnableQueryHb}, {"enableQueryHb", &tsEnableQueryHb},
{"keepColumnName", &tsKeepColumnName}, {"keepColumnName", &tsKeepColumnName},
{"keepAliveIdle", &tsKeepAliveIdle}, {"keepAliveIdle", &tsKeepAliveIdle},

View File

@ -29,7 +29,7 @@ enum TdTimezone tsTimezone = TdZeroZone;
char tsLocale[TD_LOCALE_LEN] = {0}; char tsLocale[TD_LOCALE_LEN] = {0};
char tsCharset[TD_CHARSET_LEN] = {0}; char tsCharset[TD_CHARSET_LEN] = {0};
int8_t tsDaylight = 0; int8_t tsDaylight = 0;
bool tsEnableCoreFile = 0; bool tsEnableCoreFile = 1;
int64_t tsPageSizeKB = 0; int64_t tsPageSizeKB = 0;
int64_t tsOpenMax = 0; int64_t tsOpenMax = 0;
int64_t tsStreamMax = 0; int64_t tsStreamMax = 0;