ivandika3 commented on code in PR #1175:
URL: https://github.com/apache/ratis/pull/1175#discussion_r1837368652
##########
ratis-server/src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java:
##########
@@ -326,6 +326,13 @@ public final CompletableFuture<Long> purge(long
suggestedIndex) {
if (suggestedIndex - lastPurge < purgeGap) {
return CompletableFuture.completedFuture(lastPurge);
}
+ long startIndex = getStartIndex();
+ if (suggestedIndex < startIndex) {
+ LOG.info("{}: purge is skipped since the suggested index {} is lower
than " +
+ "log start index {}",
+ getName(), suggestedIndex, startIndex);
+ return CompletableFuture.completedFuture(lastPurge);
+ }
Review Comment:
Thanks for the review. A lot clearer now. Updated as per the suggestion.
##########
ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestSegmentedRaftLog.java:
##########
@@ -150,7 +150,7 @@ static SegmentedRaftLog newSegmentedRaftLog(RaftStorage
storage, RaftProperties
.build();
}
- private SegmentedRaftLog newSegmentedRaftLogWithSnapshotIndex(RaftStorage
storage, RaftProperties properties,
+ SegmentedRaftLog newSegmentedRaftLogWithSnapshotIndex(RaftStorage storage,
RaftProperties properties,
Review Comment:
Sure. Updated.
--
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]