From fbf3641df73d607dd73916d175e011b010942a85 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 23 Sep 2022 16:50:32 +0800 Subject: [PATCH 1/6] fix: do not send ttl msg on taosd startup --- source/dnode/mnode/impl/src/mndCluster.c | 2 +- source/dnode/mnode/impl/src/mndConsumer.c | 2 ++ source/dnode/mnode/impl/src/mndMain.c | 33 ++++++++++++----------- source/dnode/mnode/impl/src/mndStb.c | 2 ++ source/dnode/mnode/impl/src/mndTelem.c | 2 +- source/dnode/mnode/impl/src/mndTrans.c | 1 + 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c index 7a3dde3cf3..70c9374821 100644 --- a/source/dnode/mnode/impl/src/mndCluster.c +++ b/source/dnode/mnode/impl/src/mndCluster.c @@ -315,7 +315,7 @@ static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) { return 0; } - mTrace("update cluster uptime to %" PRId64, clusterObj.upTime); + mInfo("update cluster uptime to %" PRId64, clusterObj.upTime); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "update-uptime"); if (pTrans == NULL) return -1; diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index e0dbc26122..e8172252a5 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -176,6 +176,8 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) { SMqConsumerObj *pConsumer; void *pIter = NULL; + mTrace("start to process mq timer"); + // rebalance cannot be parallel if (!mndRebTryStart()) { mInfo("mq rebalance already in progress, do nothing"); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 5aad4af9ac..b945a2551c 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -119,28 +119,31 @@ static void *mndThreadFp(void *param) { lastTime++; taosMsleep(100); if (mndGetStop(pMnode)) break; + if (lastTime % 10 != 0) continue; - if (lastTime % (tsTtlPushInterval * 10) == 1) { + int64_t sec = lastTime / 10; + + if (sec % tsTtlPushInterval == 0) { mndPullupTtl(pMnode); } - if (lastTime % (tsTransPullupInterval * 10) == 0) { + if (sec % tsTransPullupInterval * 10 == 0) { mndPullupTrans(pMnode); } - if (lastTime % (tsMqRebalanceInterval * 10) == 0) { + if (sec % tsMqRebalanceInterval * 10 == 0) { mndCalMqRebalance(pMnode); } - if (lastTime % (tsTelemInterval * 10) == ((tsTelemInterval - 1) * 10)) { + if (sec % tsTelemInterval * 10 == (MIN(60, (tsTelemInterval - 1)))) { mndPullupTelem(pMnode); } - if (lastTime % (tsGrantHBInterval * 10) == 0) { + if (sec % tsGrantHBInterval == 0) { mndPullupGrant(pMnode); } - if ((lastTime % (tsUptimeInterval * 10)) == ((tsUptimeInterval - 1) * 10)) { + if (sec % tsUptimeInterval == 0) { mndIncreaseUpTime(pMnode); } } @@ -399,15 +402,15 @@ void mndPreClose(SMnode *pMnode) { atomic_store_8(&(pMnode->syncMgmt.leaderTransferFinish), 0); syncLeaderTransfer(pMnode->syncMgmt.sync); - /* - mInfo("vgId:1, mnode start leader transfer"); - // wait for leader transfer finish - while (!atomic_load_8(&(pMnode->syncMgmt.leaderTransferFinish))) { - taosMsleep(10); - mInfo("vgId:1, mnode waiting for leader transfer"); - } - mInfo("vgId:1, mnode finish leader transfer"); - */ +#if 0 + mInfo("vgId:1, mnode start leader transfer"); + // wait for leader transfer finish + while (!atomic_load_8(&(pMnode->syncMgmt.leaderTransferFinish))) { + taosMsleep(10); + mInfo("vgId:1, mnode waiting for leader transfer"); + } + mInfo("vgId:1, mnode finish leader transfer"); +#endif } } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index e0b5bb1abf..02fd9f9679 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -834,6 +834,8 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) { int32_t reqLen = tSerializeSVDropTtlTableReq(NULL, 0, &ttlReq); int32_t contLen = reqLen + sizeof(SMsgHead); + mInfo("start to process ttl timer"); + while (1) { pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); if (pIter == NULL) break; diff --git a/source/dnode/mnode/impl/src/mndTelem.c b/source/dnode/mnode/impl/src/mndTelem.c index 93f7531a27..ff2461b63b 100644 --- a/source/dnode/mnode/impl/src/mndTelem.c +++ b/source/dnode/mnode/impl/src/mndTelem.c @@ -133,7 +133,7 @@ static int32_t mndProcessTelemTimer(SRpcMsg* pReq) { if (taosSendHttpReport(tsTelemServer, tsTelemPort, pCont, strlen(pCont), HTTP_FLAT) != 0) { mError("failed to send telemetry report"); } else { - mTrace("succeed to send telemetry report"); + mInfo("succeed to send telemetry report"); } taosMemoryFree(pCont); } diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index b26fb16043..cccd938e05 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -1478,6 +1478,7 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans) { } static int32_t mndProcessTransTimer(SRpcMsg *pReq) { + mTrace("start to process trans timer"); mndTransPullup(pReq->info.node); return 0; } From dafde51767504d86f09caa74cf72e5259d6c045b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 26 Sep 2022 16:40:15 +0800 Subject: [PATCH 2/6] fix: do not send ttl msg on taosd startup --- source/dnode/mnode/impl/src/mndMain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index b945a2551c..e6b6aaacf1 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -127,15 +127,15 @@ static void *mndThreadFp(void *param) { mndPullupTtl(pMnode); } - if (sec % tsTransPullupInterval * 10 == 0) { + if (sec % tsTransPullupInterval == 0) { mndPullupTrans(pMnode); } - if (sec % tsMqRebalanceInterval * 10 == 0) { + if (sec % tsMqRebalanceInterval == 0) { mndCalMqRebalance(pMnode); } - if (sec % tsTelemInterval * 10 == (MIN(60, (tsTelemInterval - 1)))) { + if (sec % tsTelemInterval == (MIN(60, (tsTelemInterval - 1)))) { mndPullupTelem(pMnode); } From 1e5dc921e0f57614f6d25db5a9b8b1183eb4438b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 26 Sep 2022 20:32:02 +0800 Subject: [PATCH 3/6] fix: set wal apply version on vnode reopen --- source/dnode/mnode/impl/src/mndMain.c | 1 - source/dnode/vnode/src/vnd/vnodeSync.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index e6b6aaacf1..32dda0b802 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -122,7 +122,6 @@ static void *mndThreadFp(void *param) { if (lastTime % 10 != 0) continue; int64_t sec = lastTime / 10; - if (sec % tsTtlPushInterval == 0) { mndPullupTtl(pMnode); } diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index a941b5955c..2c3808a703 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -688,6 +688,8 @@ static void vnodeRestoreFinish(struct SSyncFSM *pFsm) { } } while (true); + walApplyVer(pVnode->pWal, pVnode->state.applied); + pVnode->restored = true; vDebug("vgId:%d, sync restore finished", pVnode->config.vgId); } From c9aaf3de9f2095b89f78a815a9a19a5c776dae03 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 27 Sep 2022 09:00:37 +0800 Subject: [PATCH 4/6] fix: planner compiler error in windows --- source/libs/planner/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/planner/test/CMakeLists.txt b/source/libs/planner/test/CMakeLists.txt index b9d5c85717..58c9f6c94c 100644 --- a/source/libs/planner/test/CMakeLists.txt +++ b/source/libs/planner/test/CMakeLists.txt @@ -1,7 +1,7 @@ MESSAGE(STATUS "build planner unit test") -IF(NOT TD_DARWIN) +IF(TD_LINUX) # GoogleTest requires at least C++11 SET(CMAKE_CXX_STANDARD 11) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) From 67694223f3b53b44451f125edfa7cfadfe321ae8 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 27 Sep 2022 09:14:00 +0800 Subject: [PATCH 5/6] fix: planner compiler error in windows --- source/libs/planner/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/planner/test/CMakeLists.txt b/source/libs/planner/test/CMakeLists.txt index 58c9f6c94c..b9d5c85717 100644 --- a/source/libs/planner/test/CMakeLists.txt +++ b/source/libs/planner/test/CMakeLists.txt @@ -1,7 +1,7 @@ MESSAGE(STATUS "build planner unit test") -IF(TD_LINUX) +IF(NOT TD_DARWIN) # GoogleTest requires at least C++11 SET(CMAKE_CXX_STANDARD 11) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) From 8198516b7e81689a9dac3d0c3e03633106aaffa3 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 27 Sep 2022 10:27:25 +0800 Subject: [PATCH 6/6] fix: compile error in windows --- source/dnode/mnode/impl/src/mndMain.c | 2 +- utils/test/c/createTable.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 32dda0b802..a628cefa65 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -134,7 +134,7 @@ static void *mndThreadFp(void *param) { mndCalMqRebalance(pMnode); } - if (sec % tsTelemInterval == (MIN(60, (tsTelemInterval - 1)))) { + if (sec % tsTelemInterval == (TMIN(60, (tsTelemInterval - 1)))) { mndPullupTelem(pMnode); } diff --git a/utils/test/c/createTable.c b/utils/test/c/createTable.c index 6a0f8e244e..783ed85adc 100644 --- a/utils/test/c/createTable.c +++ b/utils/test/c/createTable.c @@ -201,7 +201,7 @@ void *threadFunc(void *param) { int64_t t = pInfo->tableBeginIndex; for (; t <= pInfo->tableEndIndex;) { // int64_t batch = (pInfo->tableEndIndex - t); - // batch = MIN(batch, batchNum); + // batch = TMIN(batch, batchNum); int32_t len = sprintf(qstr, "create table"); for (int32_t i = 0; i < batchNumOfTbl;) {