From d27f392beba77453b7ac9a1a4b3f5090ea048b18 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Fri, 3 Mar 2023 17:27:49 +0800 Subject: [PATCH] enh: control frequency of mnode sdb flushing with mndSdbWriteDelta --- include/common/tglobal.h | 3 +++ source/common/src/tglobal.c | 8 ++++++++ source/dnode/mnode/impl/src/mndSync.c | 2 +- source/dnode/mnode/sdb/inc/sdb.h | 2 -- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index b35b460211..86395c44da 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -74,6 +74,9 @@ extern int32_t tsHeartbeatTimeout; // vnode extern int64_t tsVndCommitMaxIntervalMs; +// mnode +extern int64_t tsMndSdbWriteDelta; + // monitor extern bool tsEnableMonitor; extern int32_t tsMonitorInterval; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 99795fcc79..023852c9fc 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -56,6 +56,7 @@ int32_t tsNumOfQnodeQueryThreads = 4; int32_t tsNumOfQnodeFetchThreads = 1; int32_t tsNumOfSnodeStreamThreads = 4; int32_t tsNumOfSnodeWriteThreads = 1; + // sync raft int32_t tsElectInterval = 25 * 1000; int32_t tsHeartbeatInterval = 1000; @@ -64,6 +65,9 @@ int32_t tsHeartbeatTimeout = 20 * 1000; // vnode int64_t tsVndCommitMaxIntervalMs = 600 * 1000; +// mnode +int64_t tsMndSdbWriteDelta = 2000; + // monitor bool tsEnableMonitor = true; int32_t tsMonitorInterval = 30; @@ -456,6 +460,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt64(pCfg, "vndCommitMaxInterval", tsVndCommitMaxIntervalMs, 1000, 1000 * 60 * 60, 0) != 0) return -1; + if (cfgAddInt64(pCfg, "mndSdbWriteDelta", tsMndSdbWriteDelta, 20, 10000, 0) != 0) return -1; + if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, 0) != 0) return -1; if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, 0) != 0) return -1; if (cfgAddString(pCfg, "monitorFqdn", tsMonitorFqdn, 0) != 0) return -1; @@ -803,6 +809,8 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsVndCommitMaxIntervalMs = cfgGetItem(pCfg, "vndCommitMaxInterval")->i64; + tsMndSdbWriteDelta = cfgGetItem(pCfg, "mndSdbWriteDelta")->i64; + tsStartUdfd = cfgGetItem(pCfg, "udf")->bval; tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs)); tstrncpy(tsUdfdLdLibPath, cfgGetItem(pCfg, "udfdLdLibPath")->str, sizeof(tsUdfdLdLibPath)); diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index edd75c62b9..f702d8f148 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -123,7 +123,7 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta } } - sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA); + sdbWriteFile(pMnode->pSdb, tsMndSdbWriteDelta); return 0; } diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index 1b7b2f9672..e9a9e425e3 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -37,8 +37,6 @@ extern "C" { #define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }} // clang-format on -#define SDB_WRITE_DELTA 2000 - #define SDB_GET_VAL(pData, dataPos, val, pos, func, type) \ { \ if (func(pRaw, dataPos, val) != 0) { \ -- GitLab