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


##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java:
##########
@@ -485,7 +546,11 @@ private class AppendLogResponseHandler implements 
StreamObserver<AppendEntriesRe
      */
     @Override
     public void onNext(AppendEntriesReplyProto reply) {
-      AppendEntriesRequest request = pendingRequests.remove(reply);
+      final AppendEntriesRequest request;
+      try (AutoCloseableLock writeLock = lock.writeLock(caller, LOG::trace)) {

Review Comment:
   Question: Why acquiring writeLock here?



##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java:
##########
@@ -571,6 +641,7 @@ public String toString() {
 
   private void updateNextIndex(long replyNextIndex) {
     try (AutoCloseableLock writeLock = lock.writeLock(caller, LOG::trace)) {
+      notifyReset("AppendEntries INCONSISTENCY", null);

Review Comment:
   How about adding `onReplyInconsistency` for INCONSISTENCY reply?  Reset 
client and INCONSISTENCY  should be treated differently.
   ```java
         
notifyAppendEntriesListener(GrpcLogAppenderListener.AppendEntries::onReplyInconsistency);
   ```



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