Skip to content

Commit 41f8345

Browse files
committed
HADOOP-9630. [RPC v9] Remove IpcSerializationType. (Junping Du via llu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1491682 13f79535-47bb-0310-9956-ffa450edef68
1 parent 9441dbd commit 41f8345

File tree

3 files changed

+8
-44
lines changed

3 files changed

+8
-44
lines changed

hadoop-common-project/hadoop-common/CHANGES.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,17 +358,19 @@ Release 2.1.0-beta - UNRELEASED
358358

359359
HADOOP-8886. Remove KFS support. (eli)
360360

361-
HADOOP-9163 The rpc msg in ProtobufRpcEngine.proto should be moved out to
361+
HADOOP-9163. [RPC v9] The rpc msg in ProtobufRpcEngine.proto should be moved out to
362362
avoid an extra copy (Sanjay Radia)
363363

364-
HADOOP-9151 Include RPC error info in RpcResponseHeader instead of sending
364+
HADOOP-9151. [RPC v9] Include RPC error info in RpcResponseHeader instead of sending
365365
it separately (sanjay Radia)
366366

367-
HADOOP-9380 Add totalLength to rpc response (sanjay Radia)
367+
HADOOP-9380. [RPC v9] Add totalLength to rpc response (sanjay Radia)
368368

369-
HADOOP-9425 Add error codes to rpc-response (sanjay Radia)
369+
HADOOP-9425. [RPC v9] Add error codes to rpc-response (sanjay Radia)
370370

371-
HADOOP-9194. RPC support for QoS. (Junping Du via llu)
371+
HADOOP-9194. [RPC v9] RPC support for QoS. (Junping Du via llu)
372+
373+
HADOOP-9630. [RPC v9] Remove IpcSerializationType. (Junping Du via llu)
372374

373375
NEW FEATURES
374376

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,6 @@ private void handleConnectionFailure(int curRetries, IOException ioe
750750
* +----------------------------------+
751751
* | Authmethod (1 byte) |
752752
* +----------------------------------+
753-
* | IpcSerializationType (1 byte) |
754-
* +----------------------------------+
755753
*/
756754
private void writeConnectionHeader(OutputStream outStream)
757755
throws IOException {
@@ -761,7 +759,6 @@ private void writeConnectionHeader(OutputStream outStream)
761759
out.write(Server.CURRENT_VERSION);
762760
out.write(serviceClass);
763761
authMethod.write(out);
764-
Server.IpcSerializationType.PROTOBUF.write(out);
765762
out.flush();
766763
}
767764

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -164,22 +164,6 @@ boolean isTerse(Class<?> t) {
164164
*/
165165
public static final ByteBuffer HEADER = ByteBuffer.wrap("hrpc".getBytes());
166166

167-
/**
168-
* Serialization type for ConnectionContext and RpcRequestHeader
169-
*/
170-
public enum IpcSerializationType {
171-
// Add new serialization type to the end without affecting the enum order
172-
PROTOBUF;
173-
174-
void write(DataOutput out) throws IOException {
175-
out.writeByte(this.ordinal());
176-
}
177-
178-
static IpcSerializationType fromByte(byte b) {
179-
return IpcSerializationType.values()[b];
180-
}
181-
}
182-
183167
/**
184168
* If the user accidentally sends an HTTP GET to an IPC port, we detect this
185169
* and send back a nicer response.
@@ -1322,7 +1306,7 @@ public int readAndProcess() throws IOException, InterruptedException {
13221306
if (!connectionHeaderRead) {
13231307
//Every connection is expected to send the header.
13241308
if (connectionHeaderBuf == null) {
1325-
connectionHeaderBuf = ByteBuffer.allocate(4);
1309+
connectionHeaderBuf = ByteBuffer.allocate(3);
13261310
}
13271311
count = channelRead(channel, connectionHeaderBuf);
13281312
if (count < 0 || connectionHeaderBuf.remaining() > 0) {
@@ -1355,13 +1339,6 @@ public int readAndProcess() throws IOException, InterruptedException {
13551339
return -1;
13561340
}
13571341

1358-
IpcSerializationType serializationType = IpcSerializationType
1359-
.fromByte(connectionHeaderBuf.get(3));
1360-
if (serializationType != IpcSerializationType.PROTOBUF) {
1361-
respondUnsupportedSerialization(serializationType);
1362-
return -1;
1363-
}
1364-
13651342
dataLengthBuffer.clear();
13661343
if (authMethod == null) {
13671344
throw new IOException("Unable to read authentication method");
@@ -1554,18 +1531,6 @@ private void setupBadVersionResponse(int clientVersion) throws IOException {
15541531
}
15551532
}
15561533

1557-
private void respondUnsupportedSerialization(IpcSerializationType st) throws IOException {
1558-
String errMsg = "Server IPC version " + CURRENT_VERSION
1559-
+ " do not support serilization " + st.toString();
1560-
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
1561-
1562-
Call fakeCall = new Call(-1, null, this);
1563-
setupResponse(buffer, fakeCall,
1564-
RpcStatusProto.FATAL, RpcErrorCodeProto.FATAL_UNSUPPORTED_SERIALIZATION,
1565-
null, IpcException.class.getName(), errMsg);
1566-
responder.doRespond(fakeCall);
1567-
}
1568-
15691534
private void setupHttpRequestOnIpcPortResponse() throws IOException {
15701535
Call fakeCall = new Call(0, null, this);
15711536
fakeCall.setResponse(ByteBuffer.wrap(

0 commit comments

Comments
 (0)