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


##########
ratis-server/src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java:
##########
@@ -274,7 +274,7 @@ public final void open(long lastIndexInSnapshot, 
Consumer<LogEntryProto> consume
         e -> commitIndex.updateToMax(e.getMetadataEntry().getCommitIndex(), 
infoIndexChange));
     state.open();
 
-    final long startIndex = getStartIndex();
+    final long startIndex = Math.max(getStartIndex(), lastIndexInSnapshot + 1);
     if (startIndex > LEAST_VALID_LOG_INDEX) {
       purgeIndex.updateIncreasingly(startIndex - 1, infoIndexChange);

Review Comment:
   I am thinking that `purgeIndex` should not depend on `lastIndexInSnapshot`.  
How about changing to `purgeIndex.updateToMax` instead?
   ```java
         purgeIndex.updateToMax(startIndex - 1, infoIndexChange);
   ```



-- 
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: issues-unsubscr...@ratis.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to