You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "szetszwo (via GitHub)" <gi...@apache.org> on 2023/09/05 15:37:32 UTC

[GitHub] [ratis] szetszwo commented on a diff in pull request #914: RATIS-1883. Next Index should be always larger than Match Index in Gr…

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


##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java:
##########
@@ -433,7 +434,7 @@ private void onNextImpl(AppendEntriesReplyProto reply) {
         case INCONSISTENCY:
           grpcServerMetrics.onRequestInconsistency(getFollowerId().toString());
           LOG.warn("{}: received {} reply with nextIndex {}", this, reply.getResult(), reply.getNextIndex());
-          updateNextIndex(reply.getNextIndex());
+          updateNextIndex(Math.max(getFollower().getMatchIndex() + 1, reply.getNextIndex()));

Review Comment:
   > ... clears the logs and meta conf, ...
   
   The follower cannot clear the existing log.  Otherwise, the committed entries can be removed.  As an example, see the description of RATIS-1677.   BTW, `runTestBootstrapReconf` is starting new peers but not removing existing logs.
   
   > ... Match index in FollowerInfoImpl is only allowed to be changed monotonously.  ...
   
   Once the log entries are matched, it cannot be changed to unmatched later on.  This is an assumption of the Raft algorithm.



-- 
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-unsubscribe@ratis.apache.org

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