You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/12/17 19:03:22 UTC

[GitHub] [incubator-ratis] avijayanhwx commented on a change in pull request #360: RATIS-1241. Leader unable to append logs to a recovering follower when its logs have been purged.

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:
users@infra.apache.org