szetszwo commented on a change in pull request #596:
URL: https://github.com/apache/ratis/pull/596#discussion_r800848928



##########
File path: 
ratis-netty/src/main/java/org/apache/ratis/netty/server/DataStreamManagement.java
##########
@@ -240,6 +240,18 @@ StreamInfo remove(ClientInvocationId key) {
     return f;
   }
 
+  private void removeDataStream(DataStreamRequestByteBuf request) {
+    try {
+      final ClientInvocationId invocationId = 
ClientInvocationId.valueOf(request.getClientId(), request.getStreamId());
+      final StreamInfo s = streams.remove(invocationId);
+      if (s != null) {
+        s.getDivision().getDataStreamMap().remove(invocationId);

Review comment:
       Just found that we could avoid s.getDivision() to throw IOException; see 
https://issues.apache.org/jira/secure/attachment/13039740/596_review.patch

##########
File path: 
ratis-netty/src/main/java/org/apache/ratis/netty/server/DataStreamManagement.java
##########
@@ -439,7 +448,7 @@ private void readImpl(DataStreamRequestByteBuf request, 
ChannelHandlerContext ct
         }, requestExecutor)).whenComplete((v, exception) -> {
       try {
         if (exception != null) {
-          streams.remove(key);
+          removeDataStream(request);

Review comment:
       We should pass `info` in this case since it could be already removed 
from `streams` at 
https://github.com/apache/ratis/blob/d41d0930c49c4cfcd8cd709519329e22fbbe61b4/ratis-netty/src/main/java/org/apache/ratis/netty/server/DataStreamManagement.java#L401




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

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


Reply via email to