diff --git a/src/mnode/inc/mnodeDef.h b/src/mnode/inc/mnodeDef.h index 46d2675705e5b7dc0ee53ba8db8f62a9ad5046df..b40080759f4167f634bff29480b6acb46e685e1f 100644 --- a/src/mnode/inc/mnodeDef.h +++ b/src/mnode/inc/mnodeDef.h @@ -135,7 +135,8 @@ typedef struct SVgObj { char dbName[TSDB_ACCT_LEN + TSDB_DB_NAME_LEN]; int8_t inUse; int8_t accessState; - int8_t reserved0[5]; + int8_t status; + int8_t reserved0[4]; SVnodeGid vnodeGid[TSDB_MAX_REPLICA]; int8_t reserved1[7]; int8_t updateEnd[1]; diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index 7e7c12cf088c823137350eb476af79df128139e2..c1b8256a06763414d96e90a11dd62a3530fe9365 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -367,7 +367,6 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { pAccess++; mnodeDecVgroupRef(pVgroup); } - } if (pDnode->status == TAOS_DN_STATUS_OFFLINE) { diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index 3855de41014deb0fe33ba09913cf13a62212f9ec..cf1796ffb4b845c74a33a36211faf8b157702ee8 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -38,6 +38,11 @@ #include "mnodeVgroup.h" #include "mnodePeer.h" +typedef enum { + TAOS_VG_STATUS_READY, + TAOS_VG_STATUS_DROPPING +} EVgroupStatus; + static void *tsVgroupSdb = NULL; static int32_t tsVgUpdateSize = 0; @@ -279,7 +284,7 @@ void mnodeCheckUnCreatedVgroup(SDnodeObj *pDnode, SVnodeLoad *pVloads, int32_t o pNextV++; } - if (i == openVnodes) { + if (i == openVnodes && pVgroup->status != TAOS_VG_STATUS_READY) { mnodeSendCreateVgroupMsg(pVgroup, NULL); } @@ -728,6 +733,7 @@ void mnodeSendDropVnodeMsg(int32_t vgId, SRpcIpSet *ipSet, void *ahandle) { } static void mnodeSendDropVgroupMsg(SVgObj *pVgroup, void *ahandle) { + pVgroup->status = TAOS_VG_STATUS_DROPPING; // deleting mDebug("vgId:%d, send drop all vnodes msg, ahandle:%p", pVgroup->vgId, ahandle); for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { SRpcIpSet ipSet = mnodeGetIpSetFromIp(pVgroup->vnodeGid[i].pDnode->dnodeEp);