You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sh...@apache.org on 2018/07/11 23:10:56 UTC
[56/56] [abbrv] hadoop git commit: HDFS-13665. [SBN read] Move RPC
response serialization into Server.doResponse(). Contributed by Plamen
Jeliazkov.
HDFS-13665. [SBN read] Move RPC response serialization into Server.doResponse(). Contributed by Plamen Jeliazkov.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/9e9e1e3a
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/9e9e1e3a
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/9e9e1e3a
Branch: refs/heads/HDFS-12943
Commit: 9e9e1e3a5ea62209ee8f65353345fdacb3743127
Parents: 5817839
Author: Plamen Jeliazkov <pl...@gmail.com>
Authored: Wed Jul 11 16:07:05 2018 -0700
Committer: Konstantin V Shvachko <sh...@apache.org>
Committed: Wed Jul 11 16:07:05 2018 -0700
----------------------------------------------------------------------
.../main/java/org/apache/hadoop/ipc/Server.java | 43 ++++++++------------
1 file changed, 17 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/9e9e1e3a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
index 1beb560..7df11cc 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
@@ -834,15 +834,15 @@ public abstract class Server {
final Writable rpcRequest; // Serialized Rpc request from client
ByteBuffer rpcResponse; // the response for this call
- private RpcResponseHeaderProto bufferedHeader; // the response header
- private Writable bufferedRv; // the byte response
+ private ResponseParams responseParams; // the response params
+ private Writable rv; // the byte response
RpcCall(RpcCall call) {
super(call);
this.connection = call.connection;
this.rpcRequest = call.rpcRequest;
- this.bufferedRv = call.bufferedRv;
- this.bufferedHeader = call.bufferedHeader;
+ this.rv = call.rv;
+ this.responseParams = call.responseParams;
}
RpcCall(Connection connection, int id) {
@@ -863,12 +863,10 @@ public abstract class Server {
this.rpcRequest = param;
}
- public void setBufferedHeader(RpcResponseHeaderProto header) {
- this.bufferedHeader = header;
- }
-
- public void setBufferedRv(Writable rv) {
- this.bufferedRv = rv;
+ void setResponseFields(Writable returnValue,
+ ResponseParams responseParams) {
+ this.rv = returnValue;
+ this.responseParams = responseParams;
}
@Override
@@ -902,9 +900,7 @@ public abstract class Server {
populateResponseParamsOnError(e, responseParams);
}
if (!isResponseDeferred()) {
- setupResponse(this, responseParams.returnStatus,
- responseParams.detailedErr,
- value, responseParams.errorClass, responseParams.error);
+ setResponseFields(value, responseParams);
sendResponse();
} else {
if (LOG.isDebugEnabled()) {
@@ -959,13 +955,11 @@ public abstract class Server {
setupResponse(call,
RpcStatusProto.FATAL, RpcErrorCodeProto.ERROR_RPC_SERVER,
null, t.getClass().getName(), StringUtils.stringifyException(t));
- } else if (alignmentContext != null) {
- // rebuild response with state context in header
- RpcResponseHeaderProto.Builder responseHeader =
- call.bufferedHeader.toBuilder();
- alignmentContext.updateResponseState(responseHeader);
- RpcResponseHeaderProto builtHeader = responseHeader.build();
- setupResponse(call, builtHeader, call.bufferedRv);
+ } else {
+ setupResponse(call, call.responseParams.returnStatus,
+ call.responseParams.detailedErr, call.rv,
+ call.responseParams.errorClass,
+ call.responseParams.error);
}
connection.sendResponse(call);
}
@@ -2949,6 +2943,9 @@ public abstract class Server {
headerBuilder.setRetryCount(call.retryCount);
headerBuilder.setStatus(status);
headerBuilder.setServerIpcVersionNum(CURRENT_VERSION);
+ if (alignmentContext != null) {
+ alignmentContext.updateResponseState(headerBuilder);
+ }
if (status == RpcStatusProto.SUCCESS) {
RpcResponseHeaderProto header = headerBuilder.build();
@@ -2975,12 +2972,6 @@ public abstract class Server {
private void setupResponse(RpcCall call,
RpcResponseHeaderProto header, Writable rv) throws IOException {
- if (alignmentContext != null && call.bufferedHeader == null
- && call.bufferedRv == null) {
- call.setBufferedHeader(header);
- call.setBufferedRv(rv);
- }
-
final byte[] response;
if (rv == null || (rv instanceof RpcWritable.ProtobufWrapper)) {
response = setupResponseForProtobuf(header, rv);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org