From 55ec5f164cae5f127c260e42c7677b64ac72402c Mon Sep 17 00:00:00 2001 From: kailixu Date: Fri, 26 Apr 2024 15:09:53 +0800 Subject: [PATCH] enh: batch create table --- include/common/tglobal.h | 1 + source/common/src/tglobal.c | 5 +++++ source/dnode/mgmt/mgmt_dnode/src/dmWorker.c | 7 ++++++- .../0-others/test_hot_refresh_configurations.py | 6 ++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 3b8929f241..6c8448a6be 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -178,6 +178,7 @@ extern int32_t tsMetaCacheMaxSize; extern int32_t tsSlowLogThreshold; extern int32_t tsSlowLogScope; extern int32_t tsTimeSeriesThreshold; +extern int64_t tsTimeSeriesInterval; extern bool tsMultiResultFunctionStarReturnTags; // client diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index d34e23c0ba..9a5392ca1f 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -181,6 +181,7 @@ int32_t tsMetaCacheMaxSize = -1; // MB int32_t tsSlowLogThreshold = 3; // seconds int32_t tsSlowLogScope = SLOW_LOG_TYPE_ALL; int32_t tsTimeSeriesThreshold = 50; +int64_t tsTimeSeriesInterval = 10; // ms bool tsMultiResultFunctionStarReturnTags = false; /* @@ -783,6 +784,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "timeseriesThreshold", tsTimeSeriesThreshold, 0, 2000, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) return -1; + if (cfgAddInt64(pCfg, "timeseriesInterval", tsTimeSeriesInterval, 1, 100, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) + return -1; if (cfgAddInt64(pCfg, "walFsyncDataSizeLimit", tsWalFsyncDataSizeLimit, 100 * 1024 * 1024, INT64_MAX, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) @@ -1239,6 +1242,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32; tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32; tsTimeSeriesThreshold = cfgGetItem(pCfg, "timeseriesThreshold")->i32; + tsTimeSeriesInterval = cfgGetItem(pCfg, "timeseriesInterval")->i64; tsWalFsyncDataSizeLimit = cfgGetItem(pCfg, "walFsyncDataSizeLimit")->i64; @@ -1557,6 +1561,7 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) { {"numOfLogLines", &tsNumOfLogLines}, {"queryRspPolicy", &tsQueryRspPolicy}, {"timeseriesThreshold", &tsTimeSeriesThreshold}, + {"timeseriesInterval", &tsTimeSeriesInterval}, {"tmqMaxTopicNum", &tmqMaxTopicNum}, {"tmqRowSize", &tmqRowSize}, {"transPullupInterval", &tsTransPullupInterval}, diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c index d124eb74be..934d4595ad 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c @@ -56,12 +56,17 @@ static void *dmNotifyThreadFp(void *param) { return NULL; } - bool wait = true; + bool wait = true; + int64_t lastNotify = 0; while (1) { if (pMgmt->pData->dropped || pMgmt->pData->stopped) break; if (wait) tsem_wait(&dmNotifyHdl.sem); atomic_store_8(&dmNotifyHdl.state, 1); + if (taosGetTimestampMs() - lastNotify < tsTimeSeriesInterval) { + taosMsleep(tsTimeSeriesInterval); + } dmSendNotifyReq(pMgmt); + lastNotify = taosGetTimestampMs(); if (1 == atomic_val_compare_exchange_8(&dmNotifyHdl.state, 1, 0)) { wait = true; continue; diff --git a/tests/system-test/0-others/test_hot_refresh_configurations.py b/tests/system-test/0-others/test_hot_refresh_configurations.py index 71f6290469..759d6074f5 100644 --- a/tests/system-test/0-others/test_hot_refresh_configurations.py +++ b/tests/system-test/0-others/test_hot_refresh_configurations.py @@ -96,6 +96,12 @@ class TDTestCase: "values": [0, 200, 2000], "except_values": [-2, 2001] }, + { + "name": "timeseriesInterval", + "alias": "tsTimeSeriesInterval", + "values": [1, 10, 100], + "except_values": [-2, 2001] + }, { "name": "minDiskFreeSize", "alias": "tsMinDiskFreeSize",