diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 0548820195..dd9589ccd4 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -179,6 +179,7 @@ extern bool tsUseAdapter; extern int32_t tsMetaCacheMaxSize; extern int32_t tsSlowLogThreshold; extern int32_t tsSlowLogThresholdTest; +extern char tsSlowLogExceptDb[]; extern int32_t tsSlowLogScope; extern int32_t tsSlowLogMaxLen; extern int32_t tsTimeSeriesThreshold; diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index dc00c3b858..7c95526f26 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -221,7 +221,9 @@ static void deregisterRequest(SRequestObj *pRequest) { } } - if (duration >= (pTscObj->pAppInfo->monitorParas.tsSlowLogThreshold * 1000000UL || duration >= tsSlowLogThresholdTest * 1000000UL)) { + if (duration >= ((pTscObj->pAppInfo->monitorParas.tsSlowLogThreshold * 1000000UL || + duration >= tsSlowLogThresholdTest * 1000000UL) && + strcmp(pRequest->pDb, tsSlowLogExceptDb) != 0)) { atomic_add_fetch_64((int64_t *)&pActivity->numOfSlowQueries, 1); if (pTscObj->pAppInfo->monitorParas.tsSlowLogScope & reqType) { taosPrintSlowLog("PID:%d, Conn:%u, QID:0x%" PRIx64 ", Start:%" PRId64 " us, Duration:%" PRId64 "us, SQL:%s", diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index eaae32bfd3..0b152abf5f 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -181,6 +181,7 @@ bool tsUseAdapter = false; int32_t tsMetaCacheMaxSize = -1; // MB int32_t tsSlowLogThreshold = 10; // seconds int32_t tsSlowLogThresholdTest = 10; // seconds +char tsSlowLogExceptDb[TSDB_DB_NAME_LEN] = "log"; // seconds int32_t tsSlowLogScope = SLOW_LOG_TYPE_QUERY; char* tsSlowLogScopeString = "query"; int32_t tsSlowLogMaxLen = 4096; @@ -702,10 +703,11 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 86400, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; - if (cfgAddInt32(pCfg, "slowLogThresholdTest", tsSlowLogThresholdTest, 0, INT32_MAX, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "slowLogThresholdTest", tsSlowLogThresholdTest, 0, INT32_MAX, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1; if (cfgAddInt32(pCfg, "slowLogThreshold", tsSlowLogThreshold, 1, INT32_MAX, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; if (cfgAddInt32(pCfg, "slowLogMaxLen", tsSlowLogMaxLen, 1, 16384, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; if (cfgAddString(pCfg, "slowLogScope", tsSlowLogScopeString, CFG_SCOPE_SERVER, CFG_DYN_SERVER) != 0) return -1; + if (cfgAddString(pCfg, "slowLogExceptDb", tsSlowLogExceptDb, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1; if (cfgAddString(pCfg, "monitorFqdn", tsMonitorFqdn, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; if (cfgAddInt32(pCfg, "monitorPort", tsMonitorPort, 1, 65056, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; @@ -1147,6 +1149,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsSIMDEnable = (bool)cfgGetItem(pCfg, "simdEnable")->bval; tsTagFilterCache = (bool)cfgGetItem(pCfg, "tagFilterCache")->bval; + tstrncpy(tsSlowLogExceptDb, cfgGetItem(pCfg, "slowLogExceptDb")->str, TSDB_DB_NAME_LEN); tsSlowLogThresholdTest = cfgGetItem(pCfg, "slowLogThresholdTest")->i32; tsSlowLogThreshold = cfgGetItem(pCfg, "slowLogThreshold")->i32; tsSlowLogMaxLen = cfgGetItem(pCfg, "slowLogMaxLen")->i32;