From e79a5232f56e6803e18ebad05c40bb56fb9a8237 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 19 Nov 2024 15:32:48 +0800 Subject: [PATCH] feat: add maxCompactConcurrency config item --- include/common/tglobal.h | 1 + source/common/src/tglobal.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 5125c1caef..2d9ae33aa9 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -77,6 +77,7 @@ extern int32_t tsReadTimeout; extern int32_t tsTimeToGetAvailableConn; extern int32_t tsKeepAliveIdle; extern int32_t tsNumOfCommitThreads; +extern int32_t tsNumOfCompactThreads; extern int32_t tsNumOfTaskQueueThreads; extern int32_t tsNumOfMnodeQueryThreads; extern int32_t tsNumOfMnodeFetchThreads; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 93c86a2dcd..266fb1478c 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -61,6 +61,7 @@ int32_t tsReadTimeout = 900; int32_t tsTimeToGetAvailableConn = 500000; int32_t tsNumOfCommitThreads = 2; +int32_t tsNumOfCompactThreads = 2; int32_t tsNumOfTaskQueueThreads = 16; int32_t tsNumOfMnodeQueryThreads = 16; int32_t tsNumOfMnodeFetchThreads = 1; @@ -688,6 +689,9 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { tsNumOfCommitThreads = tsNumOfCores / 2; tsNumOfCommitThreads = TRANGE(tsNumOfCommitThreads, 2, 4); + tsNumOfCompactThreads = tsNumOfCommitThreads; + tsNumOfCompactThreads = TRANGE(tsNumOfCompactThreads, 2, 4); + tsNumOfSupportVnodes = tsNumOfCores * 2 + 5; tsNumOfSupportVnodes = TMAX(tsNumOfSupportVnodes, 2); @@ -732,6 +736,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "queryBufferSize", tsQueryBufferSize, -1, 500000000000, CFG_SCOPE_SERVER, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "queryRspPolicy", tsQueryRspPolicy, 0, 1, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "numOfCommitThreads", tsNumOfCommitThreads, 1, 1024, CFG_SCOPE_SERVER, CFG_DYN_NONE)); + TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "maxCompactConcurrency", tsNumOfCompactThreads, 1, 1024, CFG_SCOPE_SERVER, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "retentionSpeedLimitMB", tsRetentionSpeedLimitMB, 0, 1024, CFG_SCOPE_SERVER, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "numOfMnodeReadThreads", tsNumOfMnodeReadThreads, 1, 1024, CFG_SCOPE_SERVER, CFG_DYN_NONE)); @@ -921,6 +926,14 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) { pItem->stype = stype; } + pItem = cfgGetItem(pCfg, "maxCompactConcurrency"); + if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) { + tsNumOfCompactThreads = numOfCores / 2; + tsNumOfCompactThreads = TRANGE(tsNumOfCompactThreads, 2, 4); + pItem->i32 = tsNumOfCompactThreads; + pItem->stype = stype; + } + pItem = cfgGetItem(pCfg, "numOfMnodeReadThreads"); if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) { tsNumOfMnodeReadThreads = numOfCores / 8; @@ -1406,6 +1419,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "numOfCommitThreads"); tsNumOfCommitThreads = pItem->i32; + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "maxCompactConcurrency"); + tsNumOfCompactThreads = pItem->i32; + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "retentionSpeedLimitMB"); tsRetentionSpeedLimitMB = pItem->i32;