refactor(sync): make leader life longer

This commit is contained in:
Minghao Li 2022-08-06 20:44:14 +08:00
parent f83ca89ea2
commit f8b0c98a71
1 changed files with 6 additions and 0 deletions

View File

@ -92,6 +92,12 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
}
}
// advance commit index as large as possible
SyncIndex walCommitVer = logStoreWalCommitVer(pSyncNode->pLogStore);
if (walCommitVer > newCommitIndex) {
newCommitIndex = walCommitVer;
}
// maybe execute fsm
if (newCommitIndex > pSyncNode->commitIndex) {
SyncIndex beginIndex = pSyncNode->commitIndex + 1;