You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/11/15 03:19:07 UTC

[GitHub] [incubator-ratis] runzhiwang opened a new pull request #277: RATIS-1150. Return DataStreamException to client

runzhiwang opened a new pull request #277:
URL: https://github.com/apache/incubator-ratis/pull/277


   ## What changes were proposed in this pull request?
   
   Return DataStreamException to client
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/RATIS-1150
   
   ## How was this patch tested?
   
   new u
   


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

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



[GitHub] [incubator-ratis] runzhiwang commented on pull request #277: RATIS-1150. Return DataStreamException to client

Posted by GitBox <gi...@apache.org>.
runzhiwang commented on pull request #277:
URL: https://github.com/apache/incubator-ratis/pull/277#issuecomment-727546213


   @szetszwo Thanks for suggestions. I have updated the patch, could you help review it again ?


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

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



[GitHub] [incubator-ratis] runzhiwang closed pull request #277: RATIS-1150. Return DataStreamException to client

Posted by GitBox <gi...@apache.org>.
runzhiwang closed pull request #277:
URL: https://github.com/apache/incubator-ratis/pull/277


   


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

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



[GitHub] [incubator-ratis] szetszwo merged pull request #277: RATIS-1150. Return DataStreamException to client

Posted by GitBox <gi...@apache.org>.
szetszwo merged pull request #277:
URL: https://github.com/apache/incubator-ratis/pull/277


   


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

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



[GitHub] [incubator-ratis] szetszwo commented on a change in pull request #277: RATIS-1150. Return DataStreamException to client

Posted by GitBox <gi...@apache.org>.
szetszwo commented on a change in pull request #277:
URL: https://github.com/apache/incubator-ratis/pull/277#discussion_r523717815



##########
File path: ratis-netty/src/main/java/org/apache/ratis/netty/server/DataStreamManagement.java
##########
@@ -412,7 +417,11 @@ void read(DataStreamRequestByteBuf request, ChannelHandlerContext ctx,
           }
           buf.release();
           return null;
-        }, executor));
+        }, executor)).exceptionally(exception -> {
+      replyDataStreamException(server, exception, info.getRequest(), request, ctx);
+      buf.release();
+      return null;
+    });

Review comment:
       Use whenComplete(..) and also a try-catch as below:
   ```suggestion
           }, executor)
       ).whenComplete((v, exception) -> {
         try {
           if (exception != null) {
             replyDataStreamException(server, exception, info.getRequest(), request, ctx);
           }
         } finally {
           buf.release();
         }
       });
   ```

##########
File path: ratis-netty/src/main/java/org/apache/ratis/netty/server/DataStreamManagement.java
##########
@@ -412,7 +417,11 @@ void read(DataStreamRequestByteBuf request, ChannelHandlerContext ctx,
           }
           buf.release();

Review comment:
       Remove `buf.release();` and use `whenComplete(..)` below.

##########
File path: ratis-netty/src/main/java/org/apache/ratis/netty/server/DataStreamManagement.java
##########
@@ -371,7 +373,10 @@ void read(DataStreamRequestByteBuf request, ChannelHandlerContext ctx,
       // for peers to start transaction
       final StreamInfo info = streams.get(key);
       composeAsync(info.getPrevious(), executor, v -> startTransaction(info, request, ctx))
-          .thenAccept(v -> buf.release());
+          .thenAccept(v -> buf.release()).exceptionally(exception -> {
+        replyDataStreamException(server, exception, info.getRequest(), request, ctx);
+        return null;
+      });

Review comment:
       Use whenComplete(..) and also a try-catch as below:
   ```suggestion
             .whenComplete((v, exception) -> {
           try {
             if (exception != null) {
               replyDataStreamException(server, exception, info.getRequest(), request, ctx);
             }
           } finally {
             buf.release();
           }
         });
   ```




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

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



[GitHub] [incubator-ratis] runzhiwang closed pull request #277: RATIS-1150. Return DataStreamException to client

Posted by GitBox <gi...@apache.org>.
runzhiwang closed pull request #277:
URL: https://github.com/apache/incubator-ratis/pull/277


   


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

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



[GitHub] [incubator-ratis] runzhiwang closed pull request #277: RATIS-1150. Return DataStreamException to client

Posted by GitBox <gi...@apache.org>.
runzhiwang closed pull request #277:
URL: https://github.com/apache/incubator-ratis/pull/277


   


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

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



[GitHub] [incubator-ratis] runzhiwang closed pull request #277: RATIS-1150. Return DataStreamException to client

Posted by GitBox <gi...@apache.org>.
runzhiwang closed pull request #277:
URL: https://github.com/apache/incubator-ratis/pull/277


   


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

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



[GitHub] [incubator-ratis] runzhiwang closed pull request #277: RATIS-1150. Return DataStreamException to client

Posted by GitBox <gi...@apache.org>.
runzhiwang closed pull request #277:
URL: https://github.com/apache/incubator-ratis/pull/277


   


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

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



[GitHub] [incubator-ratis] runzhiwang closed pull request #277: RATIS-1150. Return DataStreamException to client

Posted by GitBox <gi...@apache.org>.
runzhiwang closed pull request #277:
URL: https://github.com/apache/incubator-ratis/pull/277


   


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

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



[GitHub] [incubator-ratis] runzhiwang closed pull request #277: RATIS-1150. Return DataStreamException to client

Posted by GitBox <gi...@apache.org>.
runzhiwang closed pull request #277:
URL: https://github.com/apache/incubator-ratis/pull/277


   


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

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



[GitHub] [incubator-ratis] runzhiwang commented on pull request #277: RATIS-1150. Return DataStreamException to client

Posted by GitBox <gi...@apache.org>.
runzhiwang commented on pull request #277:
URL: https://github.com/apache/incubator-ratis/pull/277#issuecomment-727367149


   @szetszwo Could you help review this patch ? Thanks a lot.


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

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