avijayanhwx commented on a change in pull request #360:
URL: https://github.com/apache/incubator-ratis/pull/360#discussion_r545332107



##########
File path: 
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java
##########
@@ -568,6 +572,13 @@ private TermIndex shouldNotifyToInstallSnapshot() {
       // should be notified to install the latest snapshot through its
       // State Machine.
       return getRaftLog().getTermIndex(leaderStartIndex);
+    } else if (leaderStartIndex == RaftLog.INVALID_LOG_INDEX) {
+      // Leader has no logs to check from.
+      TermIndex snapshotTermIndex =
+          stateMachine.getLatestSnapshot().getTermIndex();
+      if (getFollower().getNextIndex() <= snapshotTermIndex.getIndex()) {
+        return snapshotTermIndex;
+      }

Review comment:
       That makes sense. Will test it out and update the patch.




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