GitHub user ConeyLiu opened a pull request:
https://github.com/apache/spark/pull/18670
[SPARK-21455]RpcFailure should be call on RpcResponseCallback.onFailure
## What changes were proposed in this pull request?
Currently, when there is a `RpcFailure` need be sent back to client, we
call `RpcCallContext.sendFailure`, then it will call
`NettyRpcCallContext.send`. However, we can see the follow code snippets in the
implementation class.
```
private[netty] class RemoteNettyRpcCallContext(
nettyEnv: NettyRpcEnv,
callback: RpcResponseCallback,
senderAddress: RpcAddress)
extends NettyRpcCallContext(senderAddress) {
override protected def send(message: Any): Unit = {
val reply = nettyEnv.serialize(message)
callback.onSuccess(reply)
}
}
```
This is unreasonable, there are two reasons:
Send back failure message by `RpcResponseCallback.onSuccess`, we can get
the details exception messages(such as `StackTrace`) in currently implements.
`RpcResponseCallback.onSuccess` and `RpcResponseCallback.onFailure` could
have different behavior. Such as:
NettyBlockTransferService#uploadBlock
```
new RpcResponseCallback {
override def onSuccess(response: ByteBuffer): Unit = {
logTrace(s"Successfully uploaded block $blockId")
result.success((): Unit)
}
override def onFailure(e: Throwable): Unit = {
logError(s"Error while uploading block $blockId", e)
result.failure(e)
}
```
## How was this patch tested?
Existing tests, and modified tests.
Please review http://spark.apache.org/contributing.html before opening a
pull request.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ConeyLiu/spark rpc
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18670.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #18670
----
commit 962b6059bcc9f5b54a4e01351993982ef7bab9f1
Author: Xianyang Liu <[email protected]>
Date: 2017-07-18T12:42:50Z
RpcFailure should be call on RpcResponseCallback.onFailure
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]