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 Jun 5, 2024
1 parent bf13033 commit dac27e4
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,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 dac27e4

Please sign in to comment.