diff --git a/src/inc/mnode.h b/src/inc/mnode.h index fbd651ce908abcad5416d12a3f7d68528c766535..5bef7402e30a0cc9f1964cc2430e0b1f5141590c 100644 --- a/src/inc/mnode.h +++ b/src/inc/mnode.h @@ -60,6 +60,7 @@ int32_t mnodeInitSystem(); int32_t mnodeStartSystem(); void mnodeCleanupSystem(); void mnodeStopSystem(); +void sdbUpdateAsync(); void sdbUpdateSync(void *pMnodes); bool mnodeIsRunning(); int32_t mnodeProcessRead(SMnodeMsg *pMsg); diff --git a/src/mnode/src/mnodeMnode.c b/src/mnode/src/mnodeMnode.c index d058d593ef4b5303241b1897b44eaac2327fc815..68828ac24d8386594b16facb2d28755891952198 100644 --- a/src/mnode/src/mnodeMnode.c +++ b/src/mnode/src/mnodeMnode.c @@ -317,7 +317,7 @@ static int32_t mnodeCreateMnodeCb(SMnodeMsg *pMsg, int32_t code) { } else { mDebug("mnode is created successfully"); mnodeUpdateMnodeEpSet(); - sdbUpdateSync(NULL); + sdbUpdateAsync(); } return code; @@ -361,7 +361,7 @@ void mnodeDropMnodeLocal(int32_t dnodeId) { } mnodeUpdateMnodeEpSet(); - sdbUpdateSync(NULL); + sdbUpdateAsync(); } int32_t mnodeDropMnode(int32_t dnodeId) { @@ -381,7 +381,7 @@ int32_t mnodeDropMnode(int32_t dnodeId) { sdbDecRef(tsMnodeSdb, pMnode); mnodeUpdateMnodeEpSet(); - sdbUpdateSync(NULL); + sdbUpdateAsync(); return code; } diff --git a/src/mnode/src/mnodeSdb.c b/src/mnode/src/mnodeSdb.c index 19ed3a82ec755e16867e4f04b9607bc1813d1404..7d04dc252dbab6b64c2a9782e25e2a4c1a388f97 100644 --- a/src/mnode/src/mnodeSdb.c +++ b/src/mnode/src/mnodeSdb.c @@ -91,6 +91,7 @@ typedef struct { } SSdbWriteWorkerPool; extern void * tsMnodeTmr; +static void * tsUpdateSyncTmr; static SSdbObject tsSdbObj = {0}; static taos_qset tsSdbWriteQset; static taos_qall tsSdbWriteQall; @@ -297,6 +298,12 @@ static void sdbConfirmForward(void *ahandle, void *param, int32_t code) { taosFreeQitem(pOper); } +static void sdbUpdateSyncTmrFp(void *param, void *tmrId) { sdbUpdateSync(NULL); } + +void sdbUpdateAsync() { + taosTmrReset(sdbUpdateSyncTmrFp, 200, NULL, tsMnodeTmr, &tsUpdateSyncTmr); +} + void sdbUpdateSync(void *pMnodes) { SDMMnodeInfos *mnodes = pMnodes; if (!mnodeIsRunning()) { diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index 3e7a946e20cdd5ea95aeb62ea4e59962af3d09ad..283132697d393d586b561d41e43d58160c0447d1 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -310,7 +310,7 @@ void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVl for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { SVnodeGid *pVgid = &pVgroup->vnodeGid[i]; if (pVgid->pDnode == pDnode) { - mTrace("dnode:%d, receive status from dnode, vgId:%d status is %d", pDnode->dnodeId, pVgroup->vgId, pVgid->role); + mTrace("dnode:%d, receive status from dnode, vgId:%d status is %d:%s", pDnode->dnodeId, pVgroup->vgId, pVgid->role, syncRole[pVgid->role]); pVgid->role = pVload->role; if (pVload->role == TAOS_SYNC_ROLE_MASTER) { pVgroup->inUse = i;