Skip to content

Commit

Permalink
RATIS-2109. RaftLogBase#updateCommitIndex should return true only if …
Browse files Browse the repository at this point in the history
…commitIndex is increased (#1109)
  • Loading branch information
ivandika3 authored and SzyWilliam committed Jun 12, 2024
1 parent f1725e2 commit f3b9d12
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,13 @@ public boolean updateCommitIndex(long majorityIndex, long currentTerm, boolean i
final long newCommitIndex = Math.min(majorityIndex, getFlushIndex());
if (oldCommittedIndex < newCommitIndex) {
if (!isLeader) {
commitIndex.updateIncreasingly(newCommitIndex, traceIndexChange);
return true;
return commitIndex.updateIncreasingly(newCommitIndex, traceIndexChange);
}

// Only update last committed index for current term. See §5.4.2 in paper for details.
final TermIndex entry = getTermIndex(newCommitIndex);
if (entry != null && entry.getTerm() == currentTerm) {
commitIndex.updateIncreasingly(newCommitIndex, traceIndexChange);
return true;
return commitIndex.updateIncreasingly(newCommitIndex, traceIndexChange);
}
}
}
Expand Down

0 comments on commit f3b9d12

Please sign in to comment.