diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 032b7548608..e67502d4fda 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -45,6 +45,10 @@ Release 0.23-PB - Unreleased HDFS-2479 HDFS Client Data Types in Protocol Buffers (sanjay) + HADOOP-7862 Hdfs changes to work with HADOOP 7862: + Move the support for multiple protocols to lower layer so that Writable, + PB and Avro can all use it (Sanjay) + BUG FIXES HDFS-2481 Unknown protocol: org.apache.hadoop.hdfs.protocol.ClientProtocol (sanjay) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java index 104eb242847..730a6fcfe2c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java @@ -142,6 +142,7 @@ import org.apache.hadoop.ipc.ProtocolSignature; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.ipc.Server; +import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; import org.apache.hadoop.metrics2.util.MBeans; import org.apache.hadoop.net.DNS; @@ -535,7 +536,7 @@ public class DataNode extends Configured InterDatanodeProtocolServerSideTranslatorR23 interDatanodeProtocolServerTranslator = new InterDatanodeProtocolServerSideTranslatorR23(this); - ipcServer.addProtocol(InterDatanodeWireProtocol.class, + ipcServer.addProtocol(RpcKind.RPC_WRITABLE, InterDatanodeWireProtocol.class, interDatanodeProtocolServerTranslator); // set service-level authorization security policy diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BackupNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BackupNode.java index a04f4de1e46..708f04cc457 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BackupNode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BackupNode.java @@ -39,6 +39,7 @@ import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol; import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo; import org.apache.hadoop.ipc.RPC; +import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; import org.apache.hadoop.net.NetUtils; /** @@ -200,7 +201,7 @@ public class BackupNode extends NameNode { super(conf, nn); JournalProtocolServerSideTranslatorR23 journalProtocolTranslator = new JournalProtocolServerSideTranslatorR23(this); - this.clientRpcServer.addProtocol(JournalWireProtocol.class, + this.clientRpcServer.addProtocol(RpcKind.RPC_WRITABLE, JournalWireProtocol.class, journalProtocolTranslator); nnRpcAddress = nn.nnRpcAddress; } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java index 89d68bbf2cd..07c3eda3d02 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java @@ -85,6 +85,7 @@ import org.apache.hadoop.io.Text; import org.apache.hadoop.ipc.ProtocolSignature; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.ipc.Server; +import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; import org.apache.hadoop.net.Node; import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.security.Groups; @@ -147,13 +148,16 @@ class NameNodeRpcServer implements NamenodeProtocols { dnSocketAddr.getHostName(), dnSocketAddr.getPort(), serviceHandlerCount, false, conf, namesystem.getDelegationTokenSecretManager()); - this.serviceRpcServer.addProtocol(DatanodeProtocol.class, this); - this.serviceRpcServer.addProtocol(NamenodeProtocol.class, this); - this.serviceRpcServer.addProtocol( + this.serviceRpcServer.addProtocol(RpcKind.RPC_WRITABLE, + DatanodeProtocol.class, this); + this.serviceRpcServer.addProtocol(RpcKind.RPC_WRITABLE, + NamenodeProtocol.class, this); + this.serviceRpcServer.addProtocol(RpcKind.RPC_WRITABLE, RefreshAuthorizationPolicyProtocol.class, this); - this.serviceRpcServer.addProtocol( + this.serviceRpcServer.addProtocol(RpcKind.RPC_WRITABLE, RefreshUserMappingsProtocol.class, this); - this.serviceRpcServer.addProtocol(GetUserMappingsProtocol.class, this); + this.serviceRpcServer.addProtocol(RpcKind.RPC_WRITABLE, + GetUserMappingsProtocol.class, this); this.serviceRPCAddress = this.serviceRpcServer.getListenerAddress(); nn.setRpcServiceServerAddress(conf, serviceRPCAddress); @@ -168,12 +172,16 @@ class NameNodeRpcServer implements NamenodeProtocols { clientProtocolServerTranslator, socAddr.getHostName(), socAddr.getPort(), handlerCount, false, conf, namesystem.getDelegationTokenSecretManager()); - this.clientRpcServer.addProtocol(DatanodeProtocol.class, this); - this.clientRpcServer.addProtocol(NamenodeProtocol.class, this); - this.clientRpcServer.addProtocol( + this.clientRpcServer.addProtocol(RpcKind.RPC_WRITABLE, + DatanodeProtocol.class, this); + this.clientRpcServer.addProtocol(RpcKind.RPC_WRITABLE, + NamenodeProtocol.class, this); + this.clientRpcServer.addProtocol(RpcKind.RPC_WRITABLE, RefreshAuthorizationPolicyProtocol.class, this); - this.clientRpcServer.addProtocol(RefreshUserMappingsProtocol.class, this); - this.clientRpcServer.addProtocol(GetUserMappingsProtocol.class, this); + this.clientRpcServer.addProtocol(RpcKind.RPC_WRITABLE, + RefreshUserMappingsProtocol.class, this); + this.clientRpcServer.addProtocol(RpcKind.RPC_WRITABLE, + GetUserMappingsProtocol.class, this); // set service-level authorization security policy diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientRetries.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientRetries.java index 05294c74d1a..59ca951ad84 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientRetries.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientRetries.java @@ -61,6 +61,7 @@ import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocols; import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.ipc.Server; +import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; import org.apache.hadoop.net.NetUtils; import org.mockito.internal.stubbing.answers.ThrowsException; import org.mockito.invocation.InvocationOnMock; @@ -96,7 +97,7 @@ public class TestDFSClientRetries extends TestCase { } @Override - public Writable call(String protocol, Writable param, long receiveTime) + public Writable call(RpcKind rpcKind, String protocol, Writable param, long receiveTime) throws IOException { if (sleep) { // sleep a bit diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestInterDatanodeProtocol.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestInterDatanodeProtocol.java index d50376aaff2..5f48651c890 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestInterDatanodeProtocol.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestInterDatanodeProtocol.java @@ -28,6 +28,7 @@ import java.net.SocketTimeoutException; import org.apache.hadoop.io.Writable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.ipc.RPC; +import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; import org.apache.hadoop.ipc.Server; import org.apache.hadoop.net.NetUtils; @@ -81,7 +82,7 @@ public class TestInterDatanodeProtocol { } @Override - public Writable call(String protocol, Writable param, long receiveTime) + public Writable call(RpcKind rpcKind, String protocol, Writable param, long receiveTime) throws IOException { if (sleep) { // sleep a bit