Victsm commented on a change in pull request #33613:
URL: https://github.com/apache/spark/pull/33613#discussion_r682952969



##########
File path: 
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/RemoteBlockPushResolver.java
##########
@@ -471,9 +488,10 @@ public void onData(String streamId, ByteBuffer buf) {
         public void onComplete(String streamId) {
           if (isStaleBlockOrTooLate) {
             // Throw an exception here so the block data is drained from 
channel and server
-            // responds RpcFailure to the client.
-            throw new RuntimeException(String.format("Block %s %s", streamId,
-              
ErrorHandler.BlockPushErrorHandler.TOO_LATE_OR_STALE_BLOCK_PUSH_MESSAGE_SUFFIX));
+            // responds the error code to the client.
+            throw new BlockPushNonFatalFailure(
+              new 
PushBlockNonFatalErrorCode(ErrorCode.TOO_LATE_OR_STALE_BLOCK_PUSH.id())

Review comment:
       @otterc you are right that we can just replace `StaleBlockPushException` 
with `BlockPushNonFatalFailure`. Catching it and later throwing another is not 
necessary.

##########
File path: 
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/RemoteBlockPushResolver.java
##########
@@ -471,9 +488,10 @@ public void onData(String streamId, ByteBuffer buf) {
         public void onComplete(String streamId) {
           if (isStaleBlockOrTooLate) {
             // Throw an exception here so the block data is drained from 
channel and server
-            // responds RpcFailure to the client.
-            throw new RuntimeException(String.format("Block %s %s", streamId,
-              
ErrorHandler.BlockPushErrorHandler.TOO_LATE_OR_STALE_BLOCK_PUSH_MESSAGE_SUFFIX));
+            // responds the error code to the client.
+            throw new BlockPushNonFatalFailure(
+              new 
PushBlockNonFatalErrorCode(ErrorCode.TOO_LATE_OR_STALE_BLOCK_PUSH.id())

Review comment:
       ~~@otterc you are right that we can just replace 
`StaleBlockPushException` with `BlockPushNonFatalFailure`. Catching it and 
later throwing another is not necessary.~~
   
   There is still difference between throwing the exception inside 
`receiveBlockDataAsStream` vs throwing it in the `StreamCallback`.
   In `TransportRequestHandler#processStreamUpload`, catching an exception 
while trying to create the `StreamCallback` would lead to server closing the 
corresponding channel.
   Since the channel might be used on the client side for pushing non-stale 
blocks as well, it's not good to just close the channel whenever the server 
sees a stale push.

##########
File path: 
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/RemoteBlockPushResolver.java
##########
@@ -471,9 +488,10 @@ public void onData(String streamId, ByteBuffer buf) {
         public void onComplete(String streamId) {
           if (isStaleBlockOrTooLate) {
             // Throw an exception here so the block data is drained from 
channel and server
-            // responds RpcFailure to the client.
-            throw new RuntimeException(String.format("Block %s %s", streamId,
-              
ErrorHandler.BlockPushErrorHandler.TOO_LATE_OR_STALE_BLOCK_PUSH_MESSAGE_SUFFIX));
+            // responds the error code to the client.
+            throw new BlockPushNonFatalFailure(
+              new 
PushBlockNonFatalErrorCode(ErrorCode.TOO_LATE_OR_STALE_BLOCK_PUSH.id())

Review comment:
       For stale push from prior app attempt, it currently indeed throws an 
IllegalArgumentException inside `receiveBlockDataAsStream` which would lead to 
server closing channels.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to