hanishakoneru commented on a change in pull request #88:
URL: https://github.com/apache/incubator-ratis/pull/88#discussion_r421767590



##########
File path: 
ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java
##########
@@ -492,6 +492,13 @@ public void syncWithSnapshot(long lastSnapshotIndex) {
     // if the last index in snapshot is larger than the index of the last
     // log entry, we should delete all the log entries and their cache to avoid
     // gaps between log segments.
+
+    // Close open log segment if entries are already included in snapshot
+    LogSegment openSegment = cache.getOpenSegment();
+    if (openSegment != null && openSegment.getEndIndex() <= lastSnapshotIndex) 
{
+      fileLogWorker.closeLogSegment(openSegment);
+    }
+    cache.clear();

Review comment:
       Done.

##########
File path: 
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java
##########
@@ -222,6 +222,10 @@ private void increaseNextIndex(AppendEntriesRequestProto 
request) {
     }
   }
 
+  private void increaseNextIndex(final long installedSnapshotIndex) {
+    getFollower().increaseNextIndex(installedSnapshotIndex + 1);

Review comment:
       Done.




----------------------------------------------------------------
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.

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


Reply via email to