From e57fd85fd4af9f7c95b415eb8836b0c3296f8066 Mon Sep 17 00:00:00 2001 From: Jitendra Nath Pandey Date: Wed, 29 Feb 2012 08:52:45 +0000 Subject: [PATCH] HDFS-3030. Remove getProtocolVersion and getProtocolSignature from translators. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1295017 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 + .../hdfs/protocol/ClientDatanodeProtocol.java | 2 +- .../hadoop/hdfs/protocol/ClientProtocol.java | 3 +- .../protocolPB/ClientDatanodeProtocolPB.java | 14 +--- ...atanodeProtocolServerSideTranslatorPB.java | 50 ------------- .../ClientDatanodeProtocolTranslatorPB.java | 13 ---- .../protocolPB/ClientNamenodeProtocolPB.java | 14 +--- ...amenodeProtocolServerSideTranslatorPB.java | 54 -------------- .../ClientNamenodeProtocolTranslatorPB.java | 70 +++++++------------ ...atanodeProtocolClientSideTranslatorPB.java | 13 ---- .../hdfs/protocolPB/DatanodeProtocolPB.java | 14 +--- ...atanodeProtocolServerSideTranslatorPB.java | 39 ----------- ...appingsProtocolClientSideTranslatorPB.java | 13 ---- .../protocolPB/GetUserMappingsProtocolPB.java | 14 +--- ...appingsProtocolServerSideTranslatorPB.java | 39 ----------- .../protocolPB/InterDatanodeProtocolPB.java | 14 +--- ...atanodeProtocolServerSideTranslatorPB.java | 52 -------------- .../InterDatanodeProtocolTranslatorPB.java | 15 ---- .../hdfs/protocolPB/JournalProtocolPB.java | 17 +---- ...JournalProtocolServerSideTranslatorPB.java | 51 -------------- .../JournalProtocolTranslatorPB.java | 13 ---- .../hdfs/protocolPB/NamenodeProtocolPB.java | 13 +--- ...amenodeProtocolServerSideTranslatorPB.java | 47 ------------- .../NamenodeProtocolTranslatorPB.java | 13 ---- ...nPolicyProtocolClientSideTranslatorPB.java | 13 ---- .../RefreshAuthorizationPolicyProtocolPB.java | 14 +--- ...nPolicyProtocolServerSideTranslatorPB.java | 39 ----------- ...appingsProtocolClientSideTranslatorPB.java | 13 ---- .../RefreshUserMappingsProtocolPB.java | 14 +--- ...appingsProtocolServerSideTranslatorPB.java | 39 ----------- .../hadoop/hdfs/server/datanode/DataNode.java | 28 ++------ .../hdfs/server/namenode/BackupNode.java | 10 --- .../server/namenode/NameNodeRpcServer.java | 56 ++++----------- .../server/protocol/DatanodeProtocol.java | 3 +- .../protocol/InterDatanodeProtocol.java | 2 +- .../hdfs/server/protocol/JournalProtocol.java | 2 +- .../server/protocol/NamenodeProtocol.java | 2 +- ...TestClientProtocolWithDelegationToken.java | 32 +++------ .../security/token/block/TestBlockToken.java | 15 +--- 39 files changed, 75 insertions(+), 797 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 4cb6dd8db6..095e9598d1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -65,6 +65,9 @@ Trunk (unreleased changes) HDFS-3014. FSEditLogOp and its subclasses should have toString() method. (Sho Shimauchi via atm) + HDFS-3030. Remove getProtocolVersion and getProtocolSignature from translators. + (jitendra) + OPTIMIZATIONS HDFS-2477. Optimize computing the diff between a block report and the diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientDatanodeProtocol.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientDatanodeProtocol.java index 1b5010c270..363e8dba3a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientDatanodeProtocol.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientDatanodeProtocol.java @@ -36,7 +36,7 @@ @KerberosInfo( serverPrincipal = DFSConfigKeys.DFS_DATANODE_USER_NAME_KEY) @TokenInfo(BlockTokenSelector.class) -public interface ClientDatanodeProtocol extends VersionedProtocol { +public interface ClientDatanodeProtocol { /** * Until version 9, this class ClientDatanodeProtocol served as both * the client interface to the DN AND the RPC protocol used to diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java index 65c17fecee..ab6babcce3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java @@ -39,7 +39,6 @@ import org.apache.hadoop.hdfs.server.namenode.SafeModeException; import org.apache.hadoop.io.EnumSetWritable; import org.apache.hadoop.io.Text; -import org.apache.hadoop.ipc.VersionedProtocol; import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.security.KerberosInfo; import org.apache.hadoop.security.token.Token; @@ -59,7 +58,7 @@ @KerberosInfo( serverPrincipal = DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY) @TokenInfo(DelegationTokenSelector.class) -public interface ClientProtocol extends VersionedProtocol { +public interface ClientProtocol { /** * Until version 69, this class ClientProtocol served as both diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolPB.java index 5829398ce8..df1a56963d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolPB.java @@ -17,15 +17,11 @@ */ package org.apache.hadoop.hdfs.protocolPB; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.ClientDatanodeProtocolService; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.hdfs.security.token.block.BlockTokenSelector; import org.apache.hadoop.ipc.ProtocolInfo; -import org.apache.hadoop.ipc.VersionedProtocol; import org.apache.hadoop.security.KerberosInfo; import org.apache.hadoop.security.token.TokenInfo; @@ -37,13 +33,5 @@ protocolVersion = 1) @InterfaceAudience.Private public interface ClientDatanodeProtocolPB extends - ClientDatanodeProtocolService.BlockingInterface, VersionedProtocol { - - /** - * This method is defined to get the protocol signature using - * ProtocolSignatureWritable - suffix of 2 to the method name - * avoids conflict. - */ - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException; + ClientDatanodeProtocolService.BlockingInterface { } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolServerSideTranslatorPB.java index 86302f4dba..627512a7fa 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolServerSideTranslatorPB.java @@ -30,10 +30,6 @@ import org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.GetReplicaVisibleLengthResponseProto; import org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.RefreshNamenodesRequestProto; import org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.RefreshNamenodesResponseProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.RPC; -import org.apache.hadoop.ipc.VersionedProtocol; import com.google.protobuf.RpcController; import com.google.protobuf.ServiceException; @@ -110,50 +106,4 @@ public GetBlockLocalPathInfoResponseProto getBlockLocalPathInfo( .setLocalPath(resp.getBlockPath()).setLocalMetaPath(resp.getMetaPath()) .build(); } - - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return RPC.getProtocolVersion(ClientDatanodeProtocolPB.class); - } - - /** - * The client side will redirect getProtocolSignature to - * getProtocolSignature2. - * - * However the RPC layer below on the Server side will call getProtocolVersion - * and possibly in the future getProtocolSignature. Hence we still implement - * it even though the end client will never call this method. - * - * @see VersionedProtocol#getProtocolVersion - */ - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link ClientDatanodeProtocol} - */ - if (!protocol.equals(RPC.getProtocolName(ClientDatanodeProtocol.class))) { - throw new IOException("Namenode Serverside implements " + - RPC.getProtocolName(ClientDatanodeProtocol.class) + - ". The following requested protocol is unknown: " + protocol); - } - - return ProtocolSignature.getProtocolSignature(clientMethodsHash, - RPC.getProtocolVersion(ClientDatanodeProtocolPB.class), - ClientDatanodeProtocolPB.class); - } - - - @Override - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link ClientDatanodeProtocol} - */ - return ProtocolSignatureWritable.convert( - this.getProtocolSignature(protocol, clientVersion, clientMethodsHash)); - } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java index d03f27060b..f6a63fba8e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java @@ -144,19 +144,6 @@ public void close() { RPC.stopProxy(rpcProxy); } - @Override - public long getProtocolVersion(String protocolName, long clientVersion) - throws IOException { - return rpcProxy.getProtocolVersion(protocolName, clientVersion); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - return ProtocolSignatureWritable.convert(rpcProxy.getProtocolSignature2( - protocol, clientVersion, clientMethodsHash)); - } - @Override public long getReplicaVisibleLength(ExtendedBlock b) throws IOException { GetReplicaVisibleLengthRequestProto req = GetReplicaVisibleLengthRequestProto diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolPB.java index 6e577cab0a..26cfaf3f9f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolPB.java @@ -17,17 +17,13 @@ */ package org.apache.hadoop.hdfs.protocolPB; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.protocol.HdfsConstants; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.ClientNamenodeProtocol; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenSelector; import org.apache.hadoop.ipc.ProtocolInfo; -import org.apache.hadoop.ipc.VersionedProtocol; import org.apache.hadoop.security.KerberosInfo; import org.apache.hadoop.security.token.TokenInfo; @@ -46,13 +42,5 @@ * add annotations required for security. */ public interface ClientNamenodeProtocolPB extends - ClientNamenodeProtocol.BlockingInterface, VersionedProtocol { - - /** - * This method is defined to get the protocol signature using - * the R23 protocol - hence we have added the suffix of 2 the method name - * to avoid conflict. - */ - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException; + ClientNamenodeProtocol.BlockingInterface { } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java index c75c349422..b22bcfd1b7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java @@ -124,17 +124,11 @@ import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.UpdatePipelineRequestProto; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.UpdatePipelineResponseProto; import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockTokenIdentifierProto; -import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ContentSummaryProto; -import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.CorruptFileBlocksProto; import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.DatanodeIDProto; import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.DatanodeInfoProto; -import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.DirectoryListingProto; import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.hdfs.server.common.UpgradeStatusReport; import org.apache.hadoop.io.Text; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.RPC; import com.google.protobuf.RpcController; import com.google.protobuf.ServiceException; @@ -163,54 +157,6 @@ public ClientNamenodeProtocolServerSideTranslatorPB(ClientProtocol server) this.server = server; } - /** - * The client side will redirect getProtocolSignature to - * getProtocolSignature2. - * - * However the RPC layer below on the Server side will call getProtocolVersion - * and possibly in the future getProtocolSignature. Hence we still implement - * it even though the end client's call will never reach here. - */ - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link ClientNamenodeProtocol} - * - */ - if (!protocol.equals(RPC.getProtocolName( - ClientNamenodeProtocolPB.class))) { - throw new IOException("Namenode Serverside implements " + - RPC.getProtocolName(ClientNamenodeProtocolPB.class) + - ". The following requested protocol is unknown: " + protocol); - } - - return ProtocolSignature.getProtocolSignature(clientMethodsHash, - RPC.getProtocolVersion(ClientNamenodeProtocolPB.class), - ClientNamenodeProtocolPB.class); - } - - @Override - public ProtocolSignatureWritable - getProtocolSignature2( - String protocol, long clientVersion, int clientMethodsHash) - throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link ClientNamenodeProtocol} - * - */ - return ProtocolSignatureWritable.convert( - this.getProtocolSignature(protocol, clientVersion, clientMethodsHash)); - } - - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return RPC.getProtocolVersion(InterDatanodeProtocolPB.class); - } - @Override public GetBlockLocationsResponseProto getBlockLocations( RpcController controller, GetBlockLocationsRequestProto req) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java index dc9e7aa43f..369158439f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java @@ -33,49 +33,26 @@ import org.apache.hadoop.fs.CreateFlag; import org.apache.hadoop.fs.FileAlreadyExistsException; import org.apache.hadoop.fs.FsServerDefaults; +import org.apache.hadoop.fs.Options.Rename; import org.apache.hadoop.fs.ParentNotDirectoryException; import org.apache.hadoop.fs.UnresolvedLinkException; -import org.apache.hadoop.fs.Options.Rename; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException; import org.apache.hadoop.hdfs.protocol.ClientProtocol; -import org.apache.hadoop.hdfs.protocol.LocatedBlock; -import org.apache.hadoop.hdfs.protocol.LocatedBlocks; import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; import org.apache.hadoop.hdfs.protocol.DSQuotaExceededException; import org.apache.hadoop.hdfs.protocol.DatanodeID; import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.DirectoryListing; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; -import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; -import org.apache.hadoop.hdfs.protocol.NSQuotaExceededException; +import org.apache.hadoop.hdfs.protocol.HdfsConstants; import org.apache.hadoop.hdfs.protocol.HdfsConstants.DatanodeReportType; import org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction; import org.apache.hadoop.hdfs.protocol.HdfsConstants.UpgradeAction; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; -import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier; -import org.apache.hadoop.hdfs.server.common.UpgradeStatusReport; -import org.apache.hadoop.hdfs.server.namenode.NameNode; -import org.apache.hadoop.hdfs.server.namenode.NotReplicatedYetException; -import org.apache.hadoop.hdfs.server.namenode.SafeModeException; -import org.apache.hadoop.io.EnumSetWritable; -import org.apache.hadoop.io.Text; -import org.apache.hadoop.io.retry.RetryPolicies; -import org.apache.hadoop.io.retry.RetryPolicy; -import org.apache.hadoop.io.retry.RetryProxy; -import org.apache.hadoop.ipc.ProtobufHelper; -import org.apache.hadoop.ipc.ProtobufRpcEngine; -import org.apache.hadoop.ipc.ProtocolMetaInterface; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.RPC; -import org.apache.hadoop.ipc.RemoteException; -import org.apache.hadoop.ipc.RpcClientUtil; -import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; -import org.apache.hadoop.net.NetUtils; -import org.apache.hadoop.security.AccessControlException; -import org.apache.hadoop.security.UserGroupInformation; -import org.apache.hadoop.security.token.Token; -import org.apache.hadoop.hdfs.protocol.HdfsConstants; +import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; +import org.apache.hadoop.hdfs.protocol.LocatedBlock; +import org.apache.hadoop.hdfs.protocol.LocatedBlocks; +import org.apache.hadoop.hdfs.protocol.NSQuotaExceededException; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.AbandonBlockRequestProto; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.AddBlockRequestProto; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.AppendRequestProto; @@ -127,6 +104,27 @@ import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.SetTimesRequestProto; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.UpdateBlockForPipelineRequestProto; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.UpdatePipelineRequestProto; +import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier; +import org.apache.hadoop.hdfs.server.common.UpgradeStatusReport; +import org.apache.hadoop.hdfs.server.namenode.NameNode; +import org.apache.hadoop.hdfs.server.namenode.NotReplicatedYetException; +import org.apache.hadoop.hdfs.server.namenode.SafeModeException; +import org.apache.hadoop.io.EnumSetWritable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.io.retry.RetryPolicies; +import org.apache.hadoop.io.retry.RetryPolicy; +import org.apache.hadoop.io.retry.RetryProxy; +import org.apache.hadoop.ipc.ProtobufHelper; +import org.apache.hadoop.ipc.ProtobufRpcEngine; +import org.apache.hadoop.ipc.ProtocolMetaInterface; +import org.apache.hadoop.ipc.RPC; +import org.apache.hadoop.ipc.RemoteException; +import org.apache.hadoop.ipc.RpcClientUtil; +import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; +import org.apache.hadoop.net.NetUtils; +import org.apache.hadoop.security.AccessControlException; +import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.security.token.Token; import com.google.protobuf.ByteString; import com.google.protobuf.ServiceException; @@ -189,20 +187,6 @@ public void close() { RPC.stopProxy(rpcProxy); } - @Override - public ProtocolSignature getProtocolSignature(String protocolName, - long clientVersion, int clientMethodHash) - throws IOException { - return ProtocolSignatureWritable.convert(rpcProxy.getProtocolSignature2( - protocolName, clientVersion, clientMethodHash)); - } - - @Override - public long getProtocolVersion(String protocolName, long clientVersion) - throws IOException { - return rpcProxy.getProtocolVersion(protocolName, clientVersion); - } - @Override public LocatedBlocks getBlockLocations(String src, long offset, long length) throws AccessControlException, FileNotFoundException, diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolClientSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolClientSideTranslatorPB.java index 7b60456458..d47eac2295 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolClientSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolClientSideTranslatorPB.java @@ -136,19 +136,6 @@ static DatanodeProtocolPB createNamenodeWithRetry( return (DatanodeProtocolPB) RetryProxy.create(DatanodeProtocolPB.class, rpcNamenode, methodNameToPolicyMap); } - - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return rpcProxy.getProtocolVersion(protocol, clientVersion); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocolName, - long clientVersion, int clientMethodsHash) throws IOException { - return ProtocolSignatureWritable.convert(rpcProxy.getProtocolSignature2( - protocolName, clientVersion, clientMethodsHash)); - } @Override public void close() throws IOException { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolPB.java index 60f0c759a3..c69cde81ca 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolPB.java @@ -18,14 +18,10 @@ package org.apache.hadoop.hdfs.protocolPB; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.DatanodeProtocolService; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.ipc.ProtocolInfo; -import org.apache.hadoop.ipc.VersionedProtocol; import org.apache.hadoop.security.KerberosInfo; @KerberosInfo( @@ -36,13 +32,5 @@ protocolVersion = 1) @InterfaceAudience.Private public interface DatanodeProtocolPB extends - DatanodeProtocolService.BlockingInterface, VersionedProtocol { - - /** - * This method is defined to get the protocol signature using - * the R23 protocol - hence we have added the suffix of 2 the method name - * to avoid conflict. - */ - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException; + DatanodeProtocolService.BlockingInterface { } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java index 2ad7f31e20..413bd3aabf 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java @@ -47,7 +47,6 @@ import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.LocatedBlockProto; import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.VersionRequestProto; import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.VersionResponseProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.hdfs.server.protocol.DatanodeCommand; import org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol; import org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration; @@ -58,8 +57,6 @@ import org.apache.hadoop.hdfs.server.protocol.StorageReceivedDeletedBlocks; import org.apache.hadoop.hdfs.server.protocol.StorageReport; import org.apache.hadoop.hdfs.server.protocol.UpgradeCommand; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.RPC; import com.google.protobuf.RpcController; import com.google.protobuf.ServiceException; @@ -268,40 +265,4 @@ public CommitBlockSynchronizationResponseProto commitBlockSynchronization( } return COMMIT_BLOCK_SYNCHRONIZATION_RESPONSE_PROTO; } - - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return RPC.getProtocolVersion(DatanodeProtocolPB.class); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link DatanodeProtocol} - */ - if (!protocol.equals(RPC.getProtocolName(DatanodeProtocolPB.class))) { - throw new IOException("Namenode Serverside implements " + - RPC.getProtocolName(DatanodeProtocolPB.class) + - ". The following requested protocol is unknown: " + protocol); - } - - return ProtocolSignature.getProtocolSignature(clientMethodsHash, - RPC.getProtocolVersion(DatanodeProtocolPB.class), - DatanodeProtocolPB.class); - } - - @Override - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link DatanodeProtocolPB} - */ - return ProtocolSignatureWritable.convert( - this.getProtocolSignature(protocol, clientVersion, clientMethodsHash)); - } - } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolClientSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolClientSideTranslatorPB.java index a968bfb01a..c29595e159 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolClientSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolClientSideTranslatorPB.java @@ -59,19 +59,6 @@ public GetUserMappingsProtocolClientSideTranslatorPB( NetUtils.getSocketFactory(conf, GetUserMappingsProtocol.class)); } - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return rpcProxy.getProtocolVersion(protocol, clientVersion); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - return ProtocolSignatureWritable.convert(rpcProxy.getProtocolSignature2( - protocol, clientVersion, clientMethodsHash)); - } - @Override public void close() throws IOException { RPC.stopProxy(rpcProxy); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolPB.java index 54eeb0a649..738ae041db 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolPB.java @@ -18,14 +18,10 @@ package org.apache.hadoop.hdfs.protocolPB; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.hdfs.protocol.proto.GetUserMappingsProtocolProtos.GetUserMappingsProtocolService; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.ipc.ProtocolInfo; -import org.apache.hadoop.ipc.VersionedProtocol; @ProtocolInfo( protocolName = "org.apache.hadoop.tools.GetUserMappingsProtocol", @@ -33,13 +29,5 @@ @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"}) @InterfaceStability.Evolving public interface GetUserMappingsProtocolPB extends - GetUserMappingsProtocolService.BlockingInterface, VersionedProtocol { - - /** - * This method is defined to get the protocol signature using - * the R23 protocol - hence we have added the suffix of 2 the method name - * to avoid conflict. - */ - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException; + GetUserMappingsProtocolService.BlockingInterface { } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolServerSideTranslatorPB.java index 4dc771dc61..bc3a6c96c3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolServerSideTranslatorPB.java @@ -22,9 +22,6 @@ import org.apache.hadoop.hdfs.protocol.proto.GetUserMappingsProtocolProtos.GetGroupsForUserRequestProto; import org.apache.hadoop.hdfs.protocol.proto.GetUserMappingsProtocolProtos.GetGroupsForUserResponseProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.tools.GetUserMappingsProtocol; import com.google.protobuf.RpcController; @@ -40,42 +37,6 @@ public GetUserMappingsProtocolServerSideTranslatorPB( this.impl = impl; } - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return RPC.getProtocolVersion(GetUserMappingsProtocolPB.class); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link GetUserMappingsProtocol} - */ - if (!protocol.equals(RPC - .getProtocolName(GetUserMappingsProtocolPB.class))) { - throw new IOException("Namenode Serverside implements " - + RPC.getProtocolName(GetUserMappingsProtocolPB.class) - + ". The following requested protocol is unknown: " + protocol); - } - - return ProtocolSignature.getProtocolSignature(clientMethodsHash, - RPC.getProtocolVersion(GetUserMappingsProtocolPB.class), - GetUserMappingsProtocolPB.class); - } - - @Override - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link GetUserMappingsProtocolPB} - */ - return ProtocolSignatureWritable.convert(this.getProtocolSignature( - protocol, clientVersion, clientMethodsHash)); - } - @Override public GetGroupsForUserResponseProto getGroupsForUser( RpcController controller, GetGroupsForUserRequestProto request) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/InterDatanodeProtocolPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/InterDatanodeProtocolPB.java index 38a148462c..45501a6cea 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/InterDatanodeProtocolPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/InterDatanodeProtocolPB.java @@ -17,14 +17,10 @@ */ package org.apache.hadoop.hdfs.protocolPB; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.protocol.proto.InterDatanodeProtocolProtos.InterDatanodeProtocolService; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.ipc.ProtocolInfo; -import org.apache.hadoop.ipc.VersionedProtocol; import org.apache.hadoop.security.KerberosInfo; @KerberosInfo( @@ -35,13 +31,5 @@ protocolVersion = 1) @InterfaceAudience.Private public interface InterDatanodeProtocolPB extends - InterDatanodeProtocolService.BlockingInterface, VersionedProtocol { - - /** - * This method is defined to get the protocol signature using - * the R23 protocol - hence we have added the suffix of 2 the method name - * to avoid conflict. - */ - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException; + InterDatanodeProtocolService.BlockingInterface { } \ No newline at end of file diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/InterDatanodeProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/InterDatanodeProtocolServerSideTranslatorPB.java index 495a0b67e7..5cf8c3a2b1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/InterDatanodeProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/InterDatanodeProtocolServerSideTranslatorPB.java @@ -25,14 +25,9 @@ import org.apache.hadoop.hdfs.protocol.proto.InterDatanodeProtocolProtos.InitReplicaRecoveryResponseProto; import org.apache.hadoop.hdfs.protocol.proto.InterDatanodeProtocolProtos.UpdateReplicaUnderRecoveryRequestProto; import org.apache.hadoop.hdfs.protocol.proto.InterDatanodeProtocolProtos.UpdateReplicaUnderRecoveryResponseProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.hdfs.server.protocol.BlockRecoveryCommand.RecoveringBlock; import org.apache.hadoop.hdfs.server.protocol.InterDatanodeProtocol; -import org.apache.hadoop.hdfs.server.protocol.JournalProtocol; import org.apache.hadoop.hdfs.server.protocol.ReplicaRecoveryInfo; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.RPC; -import org.apache.hadoop.ipc.VersionedProtocol; import com.google.protobuf.RpcController; import com.google.protobuf.ServiceException; @@ -81,51 +76,4 @@ public UpdateReplicaUnderRecoveryResponseProto updateReplicaUnderRecovery( return UpdateReplicaUnderRecoveryResponseProto.newBuilder() .setBlock(PBHelper.convert(b)).build(); } - - /** @see VersionedProtocol#getProtocolVersion */ - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return RPC.getProtocolVersion(InterDatanodeProtocolPB.class); - } - - /** - * The client side will redirect getProtocolSignature to - * getProtocolSignature2. - * - * However the RPC layer below on the Server side will call getProtocolVersion - * and possibly in the future getProtocolSignature. Hence we still implement - * it even though the end client will never call this method. - * - * @see VersionedProtocol#getProtocolVersion - */ - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link InterDatanodeProtocol} - */ - if (!protocol.equals(RPC.getProtocolName(InterDatanodeProtocol.class))) { - throw new IOException("Namenode Serverside implements " + - RPC.getProtocolName(InterDatanodeProtocol.class) + - ". The following requested protocol is unknown: " + protocol); - } - - return ProtocolSignature.getProtocolSignature(clientMethodsHash, - RPC.getProtocolVersion(InterDatanodeProtocolPB.class), - InterDatanodeProtocolPB.class); - } - - - @Override - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link InterDatanodeProtocol} - */ - return ProtocolSignatureWritable.convert( - this.getProtocolSignature(protocol, clientVersion, clientMethodsHash)); - } } \ No newline at end of file diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/InterDatanodeProtocolTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/InterDatanodeProtocolTranslatorPB.java index f19f289c9f..7c2019edf2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/InterDatanodeProtocolTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/InterDatanodeProtocolTranslatorPB.java @@ -31,14 +31,12 @@ import org.apache.hadoop.hdfs.protocol.proto.InterDatanodeProtocolProtos.InitReplicaRecoveryRequestProto; import org.apache.hadoop.hdfs.protocol.proto.InterDatanodeProtocolProtos.InitReplicaRecoveryResponseProto; import org.apache.hadoop.hdfs.protocol.proto.InterDatanodeProtocolProtos.UpdateReplicaUnderRecoveryRequestProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.hdfs.server.protocol.BlockRecoveryCommand.RecoveringBlock; import org.apache.hadoop.hdfs.server.protocol.InterDatanodeProtocol; import org.apache.hadoop.hdfs.server.protocol.ReplicaRecoveryInfo; import org.apache.hadoop.ipc.ProtobufHelper; import org.apache.hadoop.ipc.ProtobufRpcEngine; import org.apache.hadoop.ipc.ProtocolMetaInterface; -import org.apache.hadoop.ipc.ProtocolSignature; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.ipc.RpcClientUtil; import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; @@ -76,19 +74,6 @@ public void close() { RPC.stopProxy(rpcProxy); } - @Override - public long getProtocolVersion(String protocolName, long clientVersion) - throws IOException { - return rpcProxy.getProtocolVersion(protocolName, clientVersion); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - return ProtocolSignatureWritable.convert(rpcProxy.getProtocolSignature2( - protocol, clientVersion, clientMethodsHash)); - } - @Override public ReplicaRecoveryInfo initReplicaRecovery(RecoveringBlock rBlock) throws IOException { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/JournalProtocolPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/JournalProtocolPB.java index ebbdcb3d5c..f8f45f7f52 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/JournalProtocolPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/JournalProtocolPB.java @@ -17,15 +17,11 @@ */ package org.apache.hadoop.hdfs.protocolPB; -import java.io.IOException; - -import org.apache.hadoop.hdfs.protocol.proto.JournalProtocolProtos.JournalProtocolService; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; -import org.apache.hadoop.security.KerberosInfo; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hdfs.DFSConfigKeys; +import org.apache.hadoop.hdfs.protocol.proto.JournalProtocolProtos.JournalProtocolService; import org.apache.hadoop.ipc.ProtocolInfo; -import org.apache.hadoop.ipc.VersionedProtocol; +import org.apache.hadoop.security.KerberosInfo; /** * Protocol used to journal edits to a remote node. Currently, @@ -42,12 +38,5 @@ protocolVersion = 1) @InterfaceAudience.Private public interface JournalProtocolPB extends - JournalProtocolService.BlockingInterface, VersionedProtocol { - /** - * This method is defined to get the protocol signature using - * the R23 protocol - hence we have added the suffix of 2 the method name - * to avoid conflict. - */ - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException; + JournalProtocolService.BlockingInterface { } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/JournalProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/JournalProtocolServerSideTranslatorPB.java index 27dda01547..0e8b534831 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/JournalProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/JournalProtocolServerSideTranslatorPB.java @@ -24,11 +24,7 @@ import org.apache.hadoop.hdfs.protocol.proto.JournalProtocolProtos.JournalResponseProto; import org.apache.hadoop.hdfs.protocol.proto.JournalProtocolProtos.StartLogSegmentRequestProto; import org.apache.hadoop.hdfs.protocol.proto.JournalProtocolProtos.StartLogSegmentResponseProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.hdfs.server.protocol.JournalProtocol; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.RPC; -import org.apache.hadoop.ipc.VersionedProtocol; import com.google.protobuf.RpcController; import com.google.protobuf.ServiceException; @@ -73,51 +69,4 @@ public StartLogSegmentResponseProto startLogSegment(RpcController controller, } return StartLogSegmentResponseProto.newBuilder().build(); } - - /** @see VersionedProtocol#getProtocolVersion */ - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return RPC.getProtocolVersion(JournalProtocolPB.class); - } - - /** - * The client side will redirect getProtocolSignature to - * getProtocolSignature2. - * - * However the RPC layer below on the Server side will call getProtocolVersion - * and possibly in the future getProtocolSignature. Hence we still implement - * it even though the end client will never call this method. - * - * @see VersionedProtocol#getProtocolSignature(String, long, int) - */ - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link JournalProtocol} - */ - if (!protocol.equals(RPC.getProtocolName(JournalProtocolPB.class))) { - throw new IOException("Namenode Serverside implements " + - RPC.getProtocolName(JournalProtocolPB.class) + - ". The following requested protocol is unknown: " + protocol); - } - - return ProtocolSignature.getProtocolSignature(clientMethodsHash, - RPC.getProtocolVersion(JournalProtocolPB.class), - JournalProtocolPB.class); - } - - - @Override - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link JournalPBProtocol} - */ - return ProtocolSignatureWritable.convert( - this.getProtocolSignature(protocol, clientVersion, clientMethodsHash)); - } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/JournalProtocolTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/JournalProtocolTranslatorPB.java index 89d3247cd6..0735cfdbb5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/JournalProtocolTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/JournalProtocolTranslatorPB.java @@ -65,19 +65,6 @@ public void close() { RPC.stopProxy(rpcProxy); } - @Override - public long getProtocolVersion(String protocolName, long clientVersion) - throws IOException { - return rpcProxy.getProtocolVersion(protocolName, clientVersion); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - return ProtocolSignatureWritable.convert(rpcProxy.getProtocolSignature2( - protocol, clientVersion, clientMethodsHash)); - } - @Override public void journal(NamenodeRegistration reg, long firstTxnId, int numTxns, byte[] records) throws IOException { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolPB.java index 4e50af1719..a884e7a39e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolPB.java @@ -18,14 +18,10 @@ package org.apache.hadoop.hdfs.protocolPB; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos.NamenodeProtocolService; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.ipc.ProtocolInfo; -import org.apache.hadoop.ipc.VersionedProtocol; import org.apache.hadoop.security.KerberosInfo; /** @@ -43,12 +39,5 @@ protocolVersion = 1) @InterfaceAudience.Private public interface NamenodeProtocolPB extends - NamenodeProtocolService.BlockingInterface, VersionedProtocol { - /** - * This method is defined to get the protocol signature using - * the R23 protocol - hence we have added the suffix of 2 the method name - * to avoid conflict. - */ - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException; + NamenodeProtocolService.BlockingInterface { } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolServerSideTranslatorPB.java index 5ffe8e5910..bcb344d963 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolServerSideTranslatorPB.java @@ -40,7 +40,6 @@ import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos.RollEditLogResponseProto; import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos.StartCheckpointRequestProto; import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos.StartCheckpointResponseProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys; import org.apache.hadoop.hdfs.server.namenode.CheckpointSignature; import org.apache.hadoop.hdfs.server.protocol.BlocksWithLocations; @@ -49,8 +48,6 @@ import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo; import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.RPC; import com.google.protobuf.RpcController; import com.google.protobuf.ServiceException; @@ -184,50 +181,6 @@ public GetEditLogManifestResponseProto getEditLogManifest( return GetEditLogManifestResponseProto.newBuilder() .setManifest(PBHelper.convert(manifest)).build(); } - - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return RPC.getProtocolVersion(NamenodeProtocolPB.class); - } - - /** - * The client side will redirect getProtocolSignature to - * getProtocolSignature2. - * - * However the RPC layer below on the Server side will call getProtocolVersion - * and possibly in the future getProtocolSignature. Hence we still implement - * it even though the end client will never call this method. - */ - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link NamenodeProtocol} - */ - if (!protocol.equals(RPC.getProtocolName(NamenodeProtocolPB.class))) { - throw new IOException("Namenode Serverside implements " + - RPC.getProtocolName(NamenodeProtocolPB.class) + - ". The following requested protocol is unknown: " + protocol); - } - - return ProtocolSignature.getProtocolSignature(clientMethodsHash, - RPC.getProtocolVersion(NamenodeProtocolPB.class), - NamenodeProtocolPB.class); - } - - - @Override - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link NamenodePBProtocol} - */ - return ProtocolSignatureWritable.convert( - this.getProtocolSignature(protocol, clientVersion, clientMethodsHash)); - } @Override public VersionResponseProto versionRequest(RpcController controller, diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolTranslatorPB.java index d5df358a94..f2ec7ba2a9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolTranslatorPB.java @@ -102,19 +102,6 @@ public void close() { RPC.stopProxy(rpcProxy); } - @Override - public ProtocolSignature getProtocolSignature(String protocolName, - long clientVersion, int clientMethodHash) throws IOException { - return ProtocolSignatureWritable.convert(rpcProxy.getProtocolSignature2( - protocolName, clientVersion, clientMethodHash)); - } - - @Override - public long getProtocolVersion(String protocolName, long clientVersion) - throws IOException { - return rpcProxy.getProtocolVersion(protocolName, clientVersion); - } - @Override public BlocksWithLocations getBlocks(DatanodeInfo datanode, long size) throws IOException { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolClientSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolClientSideTranslatorPB.java index 22b2bcffab..0fcf424497 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolClientSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolClientSideTranslatorPB.java @@ -58,19 +58,6 @@ public RefreshAuthorizationPolicyProtocolClientSideTranslatorPB( NetUtils.getSocketFactory(conf, RefreshAuthorizationPolicyProtocol.class)); } - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return rpcProxy.getProtocolVersion(protocol, clientVersion); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - return ProtocolSignatureWritable.convert(rpcProxy.getProtocolSignature2( - protocol, clientVersion, clientMethodsHash)); - } - @Override public void close() throws IOException { RPC.stopProxy(rpcProxy); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolPB.java index 842926c932..114f789f44 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolPB.java @@ -18,15 +18,11 @@ package org.apache.hadoop.hdfs.protocolPB; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.hdfs.protocol.proto.RefreshAuthorizationPolicyProtocolProtos.RefreshAuthorizationPolicyProtocolService; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.ipc.ProtocolInfo; -import org.apache.hadoop.ipc.VersionedProtocol; import org.apache.hadoop.security.KerberosInfo; @KerberosInfo( @@ -37,13 +33,5 @@ @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"}) @InterfaceStability.Evolving public interface RefreshAuthorizationPolicyProtocolPB extends - RefreshAuthorizationPolicyProtocolService.BlockingInterface, VersionedProtocol { - - /** - * This method is defined to get the protocol signature using - * the R23 protocol - hence we have added the suffix of 2 the method name - * to avoid conflict. - */ - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException; + RefreshAuthorizationPolicyProtocolService.BlockingInterface { } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolServerSideTranslatorPB.java index 3ae8c7165d..360a42d4b3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolServerSideTranslatorPB.java @@ -22,9 +22,6 @@ import org.apache.hadoop.hdfs.protocol.proto.RefreshAuthorizationPolicyProtocolProtos.RefreshServiceAclRequestProto; import org.apache.hadoop.hdfs.protocol.proto.RefreshAuthorizationPolicyProtocolProtos.RefreshServiceAclResponseProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.security.authorize.RefreshAuthorizationPolicyProtocol; import com.google.protobuf.RpcController; @@ -40,42 +37,6 @@ public RefreshAuthorizationPolicyProtocolServerSideTranslatorPB( this.impl = impl; } - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return RPC.getProtocolVersion(RefreshAuthorizationPolicyProtocolPB.class); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link RefreshAuthorizationPolicyProtocol} - */ - if (!protocol.equals(RPC - .getProtocolName(RefreshAuthorizationPolicyProtocolPB.class))) { - throw new IOException("Namenode Serverside implements " - + RPC.getProtocolName(RefreshAuthorizationPolicyProtocolPB.class) - + ". The following requested protocol is unknown: " + protocol); - } - - return ProtocolSignature.getProtocolSignature(clientMethodsHash, - RPC.getProtocolVersion(RefreshAuthorizationPolicyProtocolPB.class), - RefreshAuthorizationPolicyProtocolPB.class); - } - - @Override - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link RefreshAuthorizationPolicyProtocolPB} - */ - return ProtocolSignatureWritable.convert(this.getProtocolSignature( - protocol, clientVersion, clientMethodsHash)); - } - @Override public RefreshServiceAclResponseProto refreshServiceAcl( RpcController controller, RefreshServiceAclRequestProto request) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolClientSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolClientSideTranslatorPB.java index c11cf511f5..eb8e059e4a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolClientSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolClientSideTranslatorPB.java @@ -59,19 +59,6 @@ public RefreshUserMappingsProtocolClientSideTranslatorPB( NetUtils.getSocketFactory(conf, RefreshUserMappingsProtocol.class)); } - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return rpcProxy.getProtocolVersion(protocol, clientVersion); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - return ProtocolSignatureWritable.convert(rpcProxy.getProtocolSignature2( - protocol, clientVersion, clientMethodsHash)); - } - @Override public void close() throws IOException { RPC.stopProxy(rpcProxy); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolPB.java index 16a77ff686..07ee24bc9c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolPB.java @@ -18,15 +18,11 @@ package org.apache.hadoop.hdfs.protocolPB; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.hdfs.protocol.proto.RefreshUserMappingsProtocolProtos.RefreshUserMappingsProtocolService; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.ipc.ProtocolInfo; -import org.apache.hadoop.ipc.VersionedProtocol; import org.apache.hadoop.security.KerberosInfo; @KerberosInfo( @@ -37,13 +33,5 @@ @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"}) @InterfaceStability.Evolving public interface RefreshUserMappingsProtocolPB extends - RefreshUserMappingsProtocolService.BlockingInterface, VersionedProtocol { - - /** - * This method is defined to get the protocol signature using - * the R23 protocol - hence we have added the suffix of 2 the method name - * to avoid conflict. - */ - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException; + RefreshUserMappingsProtocolService.BlockingInterface { } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolServerSideTranslatorPB.java index 005c654f2e..eb35189643 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolServerSideTranslatorPB.java @@ -24,9 +24,6 @@ import org.apache.hadoop.hdfs.protocol.proto.RefreshUserMappingsProtocolProtos.RefreshSuperUserGroupsConfigurationResponseProto; import org.apache.hadoop.hdfs.protocol.proto.RefreshUserMappingsProtocolProtos.RefreshUserToGroupsMappingsRequestProto; import org.apache.hadoop.hdfs.protocol.proto.RefreshUserMappingsProtocolProtos.RefreshUserToGroupsMappingsResponseProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.security.RefreshUserMappingsProtocol; import com.google.protobuf.RpcController; @@ -66,40 +63,4 @@ public RefreshUserMappingsProtocolServerSideTranslatorPB(RefreshUserMappingsProt return RefreshSuperUserGroupsConfigurationResponseProto.newBuilder() .build(); } - - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - return RPC.getProtocolVersion(RefreshUserMappingsProtocolPB.class); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link RefreshUserMappingsProtocol} - */ - if (!protocol.equals(RPC - .getProtocolName(RefreshUserMappingsProtocolPB.class))) { - throw new IOException("Namenode Serverside implements " - + RPC.getProtocolName(RefreshUserMappingsProtocolPB.class) - + ". The following requested protocol is unknown: " + protocol); - } - - return ProtocolSignature.getProtocolSignature(clientMethodsHash, - RPC.getProtocolVersion(RefreshUserMappingsProtocolPB.class), - RefreshUserMappingsProtocolPB.class); - } - - @Override - public ProtocolSignatureWritable getProtocolSignature2(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - /** - * Don't forward this to the server. The protocol version and signature is - * that of {@link RefreshUserMappingsProtocolPB} - */ - return ProtocolSignatureWritable.convert(this.getProtocolSignature( - protocol, clientVersion, clientMethodsHash)); - } } 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 6c66403b8a..86baa1a952 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 @@ -702,9 +702,12 @@ void startDataNode(Configuration conf, // DatanodeProtocol namenode, SecureResources resources ) throws IOException { - if(UserGroupInformation.isSecurityEnabled() && resources == null) - throw new RuntimeException("Cannot start secure cluster without " + - "privileged resources."); + if(UserGroupInformation.isSecurityEnabled() && resources == null) { + if (!conf.getBoolean("ignore.secure.ports.for.testing", false)) { + throw new RuntimeException("Cannot start secure cluster without " + + "privileged resources."); + } + } // settings global for all BPs in the Data Node this.secureResources = resources; @@ -1861,25 +1864,6 @@ public ExtendedBlock updateReplicaUnderRecovery(ExtendedBlock oldBlock, return new ExtendedBlock(oldBlock.getBlockPoolId(), r); } - @Override - public long getProtocolVersion(String protocol, long clientVersion - ) throws IOException { - if (protocol.equals(InterDatanodeProtocol.class.getName())) { - return InterDatanodeProtocol.versionID; - } else if (protocol.equals(ClientDatanodeProtocol.class.getName())) { - return ClientDatanodeProtocol.versionID; - } - throw new IOException("Unknown protocol to " + getClass().getSimpleName() - + ": " + protocol); - } - - @Override - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - return ProtocolSignature.getProtocolSignature( - this, protocol, clientVersion, clientMethodsHash); - } - /** A convenient class used in block recovery */ static class BlockRecord { final DatanodeID id; 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 9cc0b68c1e..05154703aa 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 @@ -42,7 +42,6 @@ import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo; import org.apache.hadoop.io.IOUtils; -import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.security.UserGroupInformation; @@ -222,15 +221,6 @@ private BackupNodeRpcServer(Configuration conf, BackupNode nn) this.clientRpcServer); nnRpcAddress = nn.nnRpcAddress; } - - @Override - public long getProtocolVersion(String protocol, long clientVersion) - throws IOException { - if (protocol.equals(JournalProtocol.class.getName())) { - return JournalProtocol.versionID; - } - return super.getProtocolVersion(protocol, clientVersion); - } ///////////////////////////////////////////////////// // NamenodeProtocol implementation for backup node. 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 e918f335f6..075060093c 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 @@ -17,6 +17,10 @@ */ package org.apache.hadoop.hdfs.server.namenode; +import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_HANDLER_COUNT_DEFAULT; +import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_HANDLER_COUNT_KEY; +import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_SERVICE_HANDLER_COUNT_DEFAULT; +import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_SERVICE_HANDLER_COUNT_KEY; import static org.apache.hadoop.hdfs.protocol.HdfsConstants.MAX_PATH_DEPTH; import static org.apache.hadoop.hdfs.protocol.HdfsConstants.MAX_PATH_LENGTH; @@ -37,50 +41,47 @@ import org.apache.hadoop.fs.UnresolvedLinkException; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.fs.permission.PermissionStatus; -import static org.apache.hadoop.hdfs.DFSConfigKeys.*; - import org.apache.hadoop.hdfs.DFSUtil; import org.apache.hadoop.hdfs.HDFSPolicyProvider; import org.apache.hadoop.hdfs.HdfsConfiguration; import org.apache.hadoop.hdfs.protocol.BlockListAsLongs; -import org.apache.hadoop.hdfs.protocol.ClientProtocol; import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; import org.apache.hadoop.hdfs.protocol.DatanodeID; import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.DirectoryListing; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; import org.apache.hadoop.hdfs.protocol.HdfsConstants; +import org.apache.hadoop.hdfs.protocol.HdfsConstants.DatanodeReportType; +import org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction; +import org.apache.hadoop.hdfs.protocol.HdfsConstants.UpgradeAction; import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; import org.apache.hadoop.hdfs.protocol.LocatedBlock; import org.apache.hadoop.hdfs.protocol.LocatedBlocks; import org.apache.hadoop.hdfs.protocol.UnregisteredNodeException; import org.apache.hadoop.hdfs.protocol.UnresolvedPathException; -import org.apache.hadoop.hdfs.protocol.HdfsConstants.DatanodeReportType; -import org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction; -import org.apache.hadoop.hdfs.protocol.HdfsConstants.UpgradeAction; import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.ClientNamenodeProtocol; -import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos.NamenodeProtocolService; import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.DatanodeProtocolService; import org.apache.hadoop.hdfs.protocol.proto.GetUserMappingsProtocolProtos.GetUserMappingsProtocolService; +import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos.NamenodeProtocolService; import org.apache.hadoop.hdfs.protocol.proto.RefreshAuthorizationPolicyProtocolProtos.RefreshAuthorizationPolicyProtocolService; import org.apache.hadoop.hdfs.protocol.proto.RefreshUserMappingsProtocolProtos.RefreshUserMappingsProtocolService; +import org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolPB; +import org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB; import org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolPB; import org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolServerSideTranslatorPB; import org.apache.hadoop.hdfs.protocolPB.GetUserMappingsProtocolPB; import org.apache.hadoop.hdfs.protocolPB.GetUserMappingsProtocolServerSideTranslatorPB; import org.apache.hadoop.hdfs.protocolPB.NamenodeProtocolPB; import org.apache.hadoop.hdfs.protocolPB.NamenodeProtocolServerSideTranslatorPB; -import org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolPB; -import org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB; import org.apache.hadoop.hdfs.protocolPB.RefreshAuthorizationPolicyProtocolPB; import org.apache.hadoop.hdfs.protocolPB.RefreshAuthorizationPolicyProtocolServerSideTranslatorPB; import org.apache.hadoop.hdfs.protocolPB.RefreshUserMappingsProtocolPB; import org.apache.hadoop.hdfs.protocolPB.RefreshUserMappingsProtocolServerSideTranslatorPB; import org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys; import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier; +import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NamenodeRole; import org.apache.hadoop.hdfs.server.common.IncorrectVersionException; import org.apache.hadoop.hdfs.server.common.UpgradeStatusReport; -import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NamenodeRole; import org.apache.hadoop.hdfs.server.namenode.metrics.NameNodeMetrics; import org.apache.hadoop.hdfs.server.namenode.web.resources.NamenodeWebHdfsMethods; import org.apache.hadoop.hdfs.server.protocol.BlocksWithLocations; @@ -90,7 +91,6 @@ import org.apache.hadoop.hdfs.server.protocol.DatanodeStorage; import org.apache.hadoop.hdfs.server.protocol.FinalizeCommand; import org.apache.hadoop.hdfs.server.protocol.NamenodeCommand; -import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol; import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocols; import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo; @@ -103,21 +103,17 @@ import org.apache.hadoop.io.EnumSetWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.ipc.ProtobufRpcEngine; -import org.apache.hadoop.ipc.ProtocolSignature; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.ipc.Server; import org.apache.hadoop.ipc.WritableRpcEngine; import org.apache.hadoop.net.Node; import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.security.Groups; -import org.apache.hadoop.security.RefreshUserMappingsProtocol; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.authorize.AuthorizationException; import org.apache.hadoop.security.authorize.ProxyUsers; -import org.apache.hadoop.security.authorize.RefreshAuthorizationPolicyProtocol; -import org.apache.hadoop.security.token.Token; import org.apache.hadoop.security.token.SecretManager.InvalidToken; -import org.apache.hadoop.tools.GetUserMappingsProtocol; +import org.apache.hadoop.security.token.Token; import com.google.protobuf.BlockingService; @@ -280,34 +276,6 @@ InetSocketAddress getServiceRpcAddress() { InetSocketAddress getRpcAddress() { return clientRpcAddress; } - - @Override // VersionedProtocol - public ProtocolSignature getProtocolSignature(String protocol, - long clientVersion, int clientMethodsHash) throws IOException { - return ProtocolSignature.getProtocolSignature( - this, protocol, clientVersion, clientMethodsHash); - } - - @Override - public long getProtocolVersion(String protocol, - long clientVersion) throws IOException { - if (protocol.equals(ClientProtocol.class.getName())) { - throw new IOException("Old Namenode Client protocol is not supported:" + - protocol + "Switch your clientside to " + ClientNamenodeProtocol.class); - } else if (protocol.equals(DatanodeProtocol.class.getName())){ - return DatanodeProtocol.versionID; - } else if (protocol.equals(NamenodeProtocol.class.getName())){ - return NamenodeProtocol.versionID; - } else if (protocol.equals(RefreshAuthorizationPolicyProtocol.class.getName())){ - return RefreshAuthorizationPolicyProtocol.versionID; - } else if (protocol.equals(RefreshUserMappingsProtocol.class.getName())){ - return RefreshUserMappingsProtocol.versionID; - } else if (protocol.equals(GetUserMappingsProtocol.class.getName())){ - return GetUserMappingsProtocol.versionID; - } else { - throw new IOException("Unknown protocol to name node: " + protocol); - } - } ///////////////////////////////////////////////////// // NamenodeProtocol diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/DatanodeProtocol.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/DatanodeProtocol.java index a12b042d4d..c9c7150def 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/DatanodeProtocol.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/DatanodeProtocol.java @@ -25,7 +25,6 @@ import org.apache.hadoop.hdfs.protocol.ExtendedBlock; import org.apache.hadoop.hdfs.protocol.DatanodeID; import org.apache.hadoop.hdfs.protocol.LocatedBlock; -import org.apache.hadoop.ipc.VersionedProtocol; import org.apache.hadoop.security.KerberosInfo; /********************************************************************** @@ -40,7 +39,7 @@ serverPrincipal = DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY, clientPrincipal = DFSConfigKeys.DFS_DATANODE_USER_NAME_KEY) @InterfaceAudience.Private -public interface DatanodeProtocol extends VersionedProtocol { +public interface DatanodeProtocol { /** * This class is used by both the Namenode (client) and BackupNode (server) * to insulate from the protocol serialization. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/InterDatanodeProtocol.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/InterDatanodeProtocol.java index 8702b0828a..50269f36ec 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/InterDatanodeProtocol.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/InterDatanodeProtocol.java @@ -35,7 +35,7 @@ serverPrincipal = DFSConfigKeys.DFS_DATANODE_USER_NAME_KEY, clientPrincipal = DFSConfigKeys.DFS_DATANODE_USER_NAME_KEY) @InterfaceAudience.Private -public interface InterDatanodeProtocol extends VersionedProtocol { +public interface InterDatanodeProtocol { public static final Log LOG = LogFactory.getLog(InterDatanodeProtocol.class); /** diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/JournalProtocol.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/JournalProtocol.java index 44570481d9..b9d55151f8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/JournalProtocol.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/JournalProtocol.java @@ -32,7 +32,7 @@ serverPrincipal = DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY, clientPrincipal = DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY) @InterfaceAudience.Private -public interface JournalProtocol extends VersionedProtocol { +public interface JournalProtocol { /** * * This class is used by both the Namenode (client) and BackupNode (server) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamenodeProtocol.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamenodeProtocol.java index a5c310b93a..59b279cd4d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamenodeProtocol.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamenodeProtocol.java @@ -36,7 +36,7 @@ serverPrincipal = DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY, clientPrincipal = DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY) @InterfaceAudience.Private -public interface NamenodeProtocol extends VersionedProtocol { +public interface NamenodeProtocol { /** * Until version 6L, this class served as both * the client interface to the NN AND the RPC protocol used to diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/security/TestClientProtocolWithDelegationToken.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/security/TestClientProtocolWithDelegationToken.java index f840e18b70..5f4696e144 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/security/TestClientProtocolWithDelegationToken.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/security/TestClientProtocolWithDelegationToken.java @@ -18,39 +18,31 @@ package org.apache.hadoop.hdfs.security; -import static org.apache.hadoop.fs.CommonConfigurationKeys.HADOOP_SECURITY_AUTHENTICATION; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; +import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; import java.net.InetSocketAddress; import java.security.PrivilegedExceptionAction; -import org.apache.commons.logging.*; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.impl.Log4JLogger; - import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.io.Text; - -import org.apache.hadoop.ipc.Client; -import org.apache.hadoop.ipc.RPC; -import org.apache.hadoop.ipc.ProtocolSignature; -import org.apache.hadoop.ipc.Server; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.protocol.ClientProtocol; -import org.apache.hadoop.net.NetUtils; -import org.apache.hadoop.security.token.Token; import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier; import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenSecretManager; import org.apache.hadoop.hdfs.server.namenode.FSNamesystem; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.ipc.Client; +import org.apache.hadoop.ipc.RPC; +import org.apache.hadoop.ipc.Server; +import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.security.SaslInputStream; import org.apache.hadoop.security.SaslRpcClient; import org.apache.hadoop.security.SaslRpcServer; import org.apache.hadoop.security.UserGroupInformation; - +import org.apache.hadoop.security.token.Token; import org.apache.log4j.Level; import org.junit.Test; @@ -80,12 +72,6 @@ public class TestClientProtocolWithDelegationToken { public void testDelegationTokenRpc() throws Exception { ClientProtocol mockNN = mock(ClientProtocol.class); FSNamesystem mockNameSys = mock(FSNamesystem.class); - when(mockNN.getProtocolVersion(anyString(), anyLong())).thenReturn( - ClientProtocol.versionID); - doReturn(ProtocolSignature.getProtocolSignature( - mockNN, ClientProtocol.class.getName(), - ClientProtocol.versionID, 0)) - .when(mockNN).getProtocolSignature(anyString(), anyLong(), anyInt()); DelegationTokenSecretManager sm = new DelegationTokenSecretManager( DFSConfigKeys.DFS_NAMENODE_DELEGATION_KEY_UPDATE_INTERVAL_DEFAULT, diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/security/token/block/TestBlockToken.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/security/token/block/TestBlockToken.java index a58394acfd..61953c85b0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/security/token/block/TestBlockToken.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/security/token/block/TestBlockToken.java @@ -23,13 +23,8 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import java.io.ByteArrayInputStream; import java.io.DataInputStream; @@ -51,12 +46,12 @@ import org.apache.hadoop.hdfs.HdfsConfiguration; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.hdfs.protocol.Block; +import org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol; import org.apache.hadoop.hdfs.protocol.DatanodeID; import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; import org.apache.hadoop.hdfs.protocol.LocatedBlock; import org.apache.hadoop.hdfs.protocol.LocatedBlocks; -import org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol; import org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.ClientDatanodeProtocolService; import org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.GetReplicaVisibleLengthRequestProto; import org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.GetReplicaVisibleLengthResponseProto; @@ -65,7 +60,6 @@ import org.apache.hadoop.io.TestWritable; import org.apache.hadoop.ipc.Client; import org.apache.hadoop.ipc.ProtobufRpcEngine; -import org.apache.hadoop.ipc.ProtocolSignature; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.ipc.Server; import org.apache.hadoop.net.NetUtils; @@ -222,13 +216,6 @@ public void testBlockTokenSecretManager() throws Exception { private Server createMockDatanode(BlockTokenSecretManager sm, Token token) throws IOException, ServiceException { ClientDatanodeProtocolPB mockDN = mock(ClientDatanodeProtocolPB.class); - when(mockDN.getProtocolVersion(anyString(), anyLong())).thenReturn( - RPC.getProtocolVersion(ClientDatanodeProtocolPB.class)); - doReturn( - ProtocolSignature.getProtocolSignature(mockDN, - ClientDatanodeProtocolPB.class.getName(), - RPC.getProtocolVersion(ClientDatanodeProtocolPB.class), 0)).when( - mockDN).getProtocolSignature(anyString(), anyLong(), anyInt()); BlockTokenIdentifier id = sm.createIdentifier(); id.readFields(new DataInputStream(new ByteArrayInputStream(token