szetszwo commented on code in PR #1130:
URL: https://github.com/apache/ratis/pull/1130#discussion_r1704905200


##########
ratis-server/src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java:
##########
@@ -230,6 +230,9 @@ private long appendMetadataImpl(long term, long 
newCommitIndex) {
     final long nextIndex;
     try(AutoCloseableLock writeLock = writeLock()) {
       nextIndex = getNextIndex();
+      if (nextIndex - 1 != newCommitIndex) {
+        return INVALID_LOG_INDEX;
+      }

Review Comment:
   > ... However, if the commitIndex was always slower than the nextIndex, it 
won't append the metadata entry until commitIndex catches up.
   
   No, it should not.  A metadata entry should be appended as soon as the 
commit index is increased.  In a busy cluster, commitIndex will never catch up 
nextIndex since it always has new entries.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to