filter voter when agree upon

This commit is contained in:
cadem 2023-04-25 15:49:17 +08:00
parent f22d279f5f
commit 7e2dee8a0f
1 changed files with 6 additions and 4 deletions

View File

@ -75,12 +75,14 @@ bool syncNodeAgreedUpon(SSyncNode* pNode, SyncIndex index) {
SSyncIndexMgr* pMatches = pNode->pMatchIndex; SSyncIndexMgr* pMatches = pNode->pMatchIndex;
ASSERT(pNode->replicaNum == pMatches->replicaNum); ASSERT(pNode->replicaNum == pMatches->replicaNum);
for (int i = 0; i < pNode->replicaNum; i++) { for (int i = 0; i < pNode->totalReplicaNum; i++) {
if(pNode->raftCfg.cfg.nodeInfo[i].nodeRole == TAOS_SYNC_ROLE_VOTER){
SyncIndex matchIndex = pMatches->index[i]; SyncIndex matchIndex = pMatches->index[i];
if (matchIndex >= index) { if (matchIndex >= index) {
count++; count++;
} }
} }
}
return count >= pNode->quorum; return count >= pNode->quorum;
} }