This is an automated email from the ASF dual-hosted git repository.
szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git
The following commit(s) were added to refs/heads/master by this push:
new dac27e4fd RATIS-2109. RaftLogBase#updateCommitIndex should return true
only if commitIndex is increased (#1109)
dac27e4fd is described below
commit dac27e4fd3df042fcf50ed549404e4d82708ed2b
Author: Ivan Andika <[email protected]>
AuthorDate: Wed Jun 5 20:01:42 2024 +0800
RATIS-2109. RaftLogBase#updateCommitIndex should return true only if
commitIndex is increased (#1109)
---
.../src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git
a/ratis-server/src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java
b/ratis-server/src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java
index 064e509fd..4dd9fc1da 100644
---
a/ratis-server/src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java
+++
b/ratis-server/src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java
@@ -127,15 +127,13 @@ public abstract class RaftLogBase implements RaftLog {
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);
}
}
}