szetszwo commented on code in PR #939:
URL: https://github.com/apache/ratis/pull/939#discussion_r1361171726
##########
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:
@Brokenice0415 , The existing code seems correct -- since it got an error,
it should try resending the same (previous log index + 1) even if (previous log
index + 1 <= match index). There might be a good reason behind. We should
ask why it tried to send it previously? We should not update it blindly.
--
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]