HADOOP-7524 Change RPC to allow multiple protocols including multuple versions of the same protocol (sanjay Radia)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1173488 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sanjay Radia 2011-09-21 04:25:55 +00:00
parent 4dc4e9e63f
commit 7d8e9d6960
3 changed files with 16 additions and 3 deletions

View File

@ -38,6 +38,8 @@ Trunk (unreleased changes)
not use ArrayWritable for writing non-array items. (Uma Maheswara Rao G not use ArrayWritable for writing non-array items. (Uma Maheswara Rao G
via szetszwo) via szetszwo)
HDFS-2351 Change Namenode and Datanode to register each of their protocols seperately (Sanjay Radia)
BUG FIXES BUG FIXES
HDFS-2287. TestParallelRead has a small off-by-one bug. (todd) HDFS-2287. TestParallelRead has a small off-by-one bug. (todd)

View File

@ -425,7 +425,7 @@ public class DataNode extends Configured
private List<ServicePlugin> plugins; private List<ServicePlugin> plugins;
// For InterDataNodeProtocol // For InterDataNodeProtocol
public Server ipcServer; public RPC.Server ipcServer;
private SecureResources secureResources = null; private SecureResources secureResources = null;
private AbstractList<File> dataDirs; private AbstractList<File> dataDirs;
@ -575,11 +575,15 @@ public class DataNode extends Configured
private void initIpcServer(Configuration conf) throws IOException { private void initIpcServer(Configuration conf) throws IOException {
InetSocketAddress ipcAddr = NetUtils.createSocketAddr( InetSocketAddress ipcAddr = NetUtils.createSocketAddr(
conf.get("dfs.datanode.ipc.address")); conf.get("dfs.datanode.ipc.address"));
ipcServer = RPC.getServer(DataNode.class, this, ipcAddr.getHostName(),
// Add all the RPC protocols that the Datanode implements
ipcServer = RPC.getServer(ClientDatanodeProtocol.class, this, ipcAddr.getHostName(),
ipcAddr.getPort(), ipcAddr.getPort(),
conf.getInt(DFS_DATANODE_HANDLER_COUNT_KEY, conf.getInt(DFS_DATANODE_HANDLER_COUNT_KEY,
DFS_DATANODE_HANDLER_COUNT_DEFAULT), DFS_DATANODE_HANDLER_COUNT_DEFAULT),
false, conf, blockPoolTokenSecretManager); false, conf, blockPoolTokenSecretManager);
ipcServer.addProtocol(InterDatanodeProtocol.class, this);
// set service-level authorization security policy // set service-level authorization security policy
if (conf.getBoolean( if (conf.getBoolean(
CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION, false)) { CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION, false)) {

View File

@ -142,10 +142,17 @@ class NameNodeRpcServer implements NamenodeProtocols {
serviceRpcServer = null; serviceRpcServer = null;
serviceRPCAddress = null; serviceRPCAddress = null;
} }
this.server = RPC.getServer(NamenodeProtocols.class, this, // Add all the RPC protocols that the namenode implements
this.server = RPC.getServer(ClientProtocol.class, this,
socAddr.getHostName(), socAddr.getPort(), socAddr.getHostName(), socAddr.getPort(),
handlerCount, false, conf, handlerCount, false, conf,
namesystem.getDelegationTokenSecretManager()); namesystem.getDelegationTokenSecretManager());
this.server.addProtocol(DatanodeProtocol.class, this);
this.server.addProtocol(NamenodeProtocol.class, this);
this.server.addProtocol(RefreshAuthorizationPolicyProtocol.class, this);
this.server.addProtocol(RefreshUserMappingsProtocol.class, this);
this.server.addProtocol(GetUserMappingsProtocol.class, this);
// set service-level authorization security policy // set service-level authorization security policy
if (serviceAuthEnabled = if (serviceAuthEnabled =