Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
enh: improve vgroup readiness check by tracking leader and follower r…
…estoration states
  • Loading branch information
cadem committed Dec 1, 2025
commit dcc75cf51bd44999850abe8e8024e450fdd778a5
11 changes: 9 additions & 2 deletions source/dnode/mnode/impl/src/mndVgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,8 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
}

bool isReady = false;
bool isLeaderRestored = false;
bool hasFollowerRestored = false;
// default 3 replica, add 1 replica if move vnode
for (int32_t i = 0; i < 4; ++i) {
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
Expand Down Expand Up @@ -1225,8 +1227,12 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
if (pVgroup->vnodeGid[i].syncState == TAOS_SYNC_STATE_LEADER ||
pVgroup->vnodeGid[i].syncState == TAOS_SYNC_STATE_ASSIGNED_LEADER) {
if (pVgroup->vnodeGid[i].syncRestore) {
isReady = true;
}
isLeaderRestored = true;
}
} else if (pVgroup->vnodeGid[i].syncState == TAOS_SYNC_STATE_FOLLOWER) {
if (pVgroup->vnodeGid[i].syncRestore) {
hasFollowerRestored = true;
}
}
snprintf(role, sizeof(role), "%s", syncStr(pVgroup->vnodeGid[i].syncState));
/*
Expand Down Expand Up @@ -1283,6 +1289,7 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
}
}

if (isLeaderRestored && hasFollowerRestored) isReady = true;
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
code = colDataSetVal(pColInfo, numOfRows, (const char *)&isReady, false);
if (code != 0) {
Expand Down
Loading