diff --git a/src/dnode/src/dnodeModule.c b/src/dnode/src/dnodeModule.c index bcbc98b5b3aff0825a4d92f8ff612344c3720ce6..0a5b9b550cab09a4bdd5abb25c28aa5c202d8f90 100644 --- a/src/dnode/src/dnodeModule.c +++ b/src/dnode/src/dnodeModule.c @@ -146,8 +146,8 @@ void dnodeProcessModuleStatus(uint32_t moduleStatus) { } } -void dnodeCheckModules() { - if (tsModuleStatus & TSDB_MOD_MNODE) return; +bool dnodeCheckMnodeStarting() { + if (tsModuleStatus & TSDB_MOD_MNODE) return false; SDMMnodeInfos *mnodes = dnodeGetMnodeInfos(); for (int32_t i = 0; i < mnodes->nodeNum; ++i) { @@ -156,7 +156,9 @@ void dnodeCheckModules() { uint32_t moduleStatus = tsModuleStatus | (1 << TSDB_MOD_MNODE);; dInfo("start mnode module, module status:%d, new status:%d", tsModuleStatus, moduleStatus); dnodeProcessModuleStatus(moduleStatus); - break; + return true; } } + + return false; } diff --git a/src/inc/dnode.h b/src/inc/dnode.h index 028041b2d25147311315d23e67bad3b2e4d1bcf9..fda9c1c1ddd928ccf02bd6fd8a1480b30769bb6b 100644 --- a/src/inc/dnode.h +++ b/src/inc/dnode.h @@ -43,7 +43,7 @@ void dnodeGetMnodeEpSetForPeer(void *epSet); void dnodeGetMnodeEpSetForShell(void *epSet); void * dnodeGetMnodeInfos(); int32_t dnodeGetDnodeId(); -void dnodeCheckModules(); +bool dnodeCheckMnodeStarting(); void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)); void dnodeSendMsgToDnode(SRpcEpSet *epSet, SRpcMsg *rpcMsg); diff --git a/src/mnode/src/mnodeSdb.c b/src/mnode/src/mnodeSdb.c index 3ff5cc48285909fac861271d78441c009fbccd7c..60f1e8e80bb9e364884c1c40ebf3bbb4fee5b871 100644 --- a/src/mnode/src/mnodeSdb.c +++ b/src/mnode/src/mnodeSdb.c @@ -298,8 +298,9 @@ static void sdbUpdateSyncTmrFp(void *param, void *tmrId) { sdbUpdateSync(); } void sdbUpdateSync() { if (!mnodeIsRunning()) { mDebug("mnode not start yet, update sync info later"); - dnodeCheckModules(); - taosTmrReset(sdbUpdateSyncTmrFp, 1000, NULL, tsMnodeTmr, &tsUpdateSyncTmr); + if (dnodeCheckMnodeStarting()) { + taosTmrReset(sdbUpdateSyncTmrFp, 1000, NULL, tsMnodeTmr, &tsUpdateSyncTmr); + } return; } mDebug("update sync info in sdb"); diff --git a/tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim b/tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim index b625619678c0670c2e0d92d88e63f4e34765a3da..aaf0da8553886b8da1f6df7107a8b25bff531705 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim @@ -53,7 +53,7 @@ system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start sql create dnode $hostname2 sql create dnode $hostname3 -sleep 3000 +sleep 5000 $sleepTimer = 3000 @@ -225,6 +225,7 @@ if $data00 != $totalRows then endi print ============== step5: stop dnode2, and remove its vnode +sleep 5000 system sh/exec.sh -n dnode2 -s stop -x SIGINT sleep $sleepTimer diff --git a/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim b/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim index 10964b9209eeea8a5d93f7a47b804a66b5d8e9bb..3715be5fa9b4d9b5a623806ed3330e313edae2f1 100644 --- a/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim +++ b/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim @@ -193,6 +193,7 @@ if $data00 != $totalRows then endi print ============== step5: stop dnode1 +sleep 5000 system sh/exec.sh -n dnode1 -s stop sleep 3000 diff --git a/tests/script/unique/dnode/alternativeRole.sim b/tests/script/unique/dnode/alternativeRole.sim index ab37c1603a82c120d797cbc1e0fbe53f228e6b1a..b5d861c44f6b98e32309f4a187f54c7d8c7c6bfa 100644 --- a/tests/script/unique/dnode/alternativeRole.sim +++ b/tests/script/unique/dnode/alternativeRole.sim @@ -18,13 +18,14 @@ system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 print ========== step1 system sh/exec.sh -n dnode1 -s start +sleep 3000 sql connect + sql create dnode $hostname2 system sh/exec.sh -n dnode2 -s start -sleep 3000 sql create dnode $hostname3 system sh/exec.sh -n dnode3 -s start -sleep 3000 +sleep 5000 sql show dnodes print dnode1 $data5_1