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


##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java:
##########
@@ -143,7 +143,12 @@ private void resetClient(AppendEntriesRequest request, 
boolean onError) {
       if (request != null && request.isHeartbeat()) {
         return;
       }
-      getFollower().decreaseNextIndex(nextIndex);
+      // decrease next index
+      final long oldNextIndex = getFollower().getNextIndex();
+      final long matchIndex = getFollower().getMatchIndex();
+      getFollower().updateNextIndex(
+              Math.max(matchIndex + 1
+                      , oldNextIndex <= 0L? oldNextIndex: 
Math.min(oldNextIndex - 1, nextIndex)));

Review Comment:
   One reason could be due to inconsistency; see `getNextIndexForInconsistency`.



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

Reply via email to