|
@@ -61,12 +61,21 @@ import org.apache.hadoop.hdfs.protocol.HdfsConstants.UpgradeAction;
|
|
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.ClientNamenodeProtocol;
|
|
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.NamenodeProtocolProtos.NamenodeProtocolService;
|
|
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.DatanodeProtocolService;
|
|
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.RefreshAuthorizationPolicyProtocolProtos.RefreshAuthorizationPolicyProtocolService;
|
|
|
|
+import org.apache.hadoop.hdfs.protocol.proto.RefreshUserMappingsProtocolProtos.RefreshUserMappingsProtocolService;
|
|
import org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolPB;
|
|
import org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolPB;
|
|
import org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolServerSideTranslatorPB;
|
|
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.NamenodeProtocolPB;
|
|
import org.apache.hadoop.hdfs.protocolPB.NamenodeProtocolServerSideTranslatorPB;
|
|
import org.apache.hadoop.hdfs.protocolPB.NamenodeProtocolServerSideTranslatorPB;
|
|
import org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolPB;
|
|
import org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolPB;
|
|
import org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB;
|
|
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.block.ExportedBlockKeys;
|
|
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
|
|
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
|
|
import org.apache.hadoop.hdfs.server.common.IncorrectVersionException;
|
|
import org.apache.hadoop.hdfs.server.common.IncorrectVersionException;
|
|
@@ -95,7 +104,6 @@ import org.apache.hadoop.ipc.ProtocolSignature;
|
|
import org.apache.hadoop.ipc.RPC;
|
|
import org.apache.hadoop.ipc.RPC;
|
|
import org.apache.hadoop.ipc.Server;
|
|
import org.apache.hadoop.ipc.Server;
|
|
import org.apache.hadoop.ipc.WritableRpcEngine;
|
|
import org.apache.hadoop.ipc.WritableRpcEngine;
|
|
-import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind;
|
|
|
|
import org.apache.hadoop.net.Node;
|
|
import org.apache.hadoop.net.Node;
|
|
import org.apache.hadoop.security.AccessControlException;
|
|
import org.apache.hadoop.security.AccessControlException;
|
|
import org.apache.hadoop.security.Groups;
|
|
import org.apache.hadoop.security.Groups;
|
|
@@ -161,7 +169,22 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
new NamenodeProtocolServerSideTranslatorPB(this);
|
|
new NamenodeProtocolServerSideTranslatorPB(this);
|
|
BlockingService NNPbService = NamenodeProtocolService
|
|
BlockingService NNPbService = NamenodeProtocolService
|
|
.newReflectiveBlockingService(namenodeProtocolXlator);
|
|
.newReflectiveBlockingService(namenodeProtocolXlator);
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ RefreshAuthorizationPolicyProtocolServerSideTranslatorPB refreshAuthPolicyXlator =
|
|
|
|
+ new RefreshAuthorizationPolicyProtocolServerSideTranslatorPB(this);
|
|
|
|
+ BlockingService refreshAuthService = RefreshAuthorizationPolicyProtocolService
|
|
|
|
+ .newReflectiveBlockingService(refreshAuthPolicyXlator);
|
|
|
|
+
|
|
|
|
+ RefreshUserMappingsProtocolServerSideTranslatorPB refreshUserMappingXlator =
|
|
|
|
+ new RefreshUserMappingsProtocolServerSideTranslatorPB(this);
|
|
|
|
+ BlockingService refreshUserMappingService = RefreshUserMappingsProtocolService
|
|
|
|
+ .newReflectiveBlockingService(refreshUserMappingXlator);
|
|
|
|
+
|
|
|
|
+ GetUserMappingsProtocolServerSideTranslatorPB getUserMappingXlator =
|
|
|
|
+ new GetUserMappingsProtocolServerSideTranslatorPB(this);
|
|
|
|
+ BlockingService getUserMappingService = GetUserMappingsProtocolService
|
|
|
|
+ .newReflectiveBlockingService(getUserMappingXlator);
|
|
|
|
+
|
|
WritableRpcEngine.ensureInitialized();
|
|
WritableRpcEngine.ensureInitialized();
|
|
|
|
|
|
InetSocketAddress dnSocketAddr = nn.getServiceRpcServerAddress(conf);
|
|
InetSocketAddress dnSocketAddr = nn.getServiceRpcServerAddress(conf);
|
|
@@ -176,17 +199,17 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
dnSocketAddr.getHostName(), dnSocketAddr.getPort(),
|
|
dnSocketAddr.getHostName(), dnSocketAddr.getPort(),
|
|
serviceHandlerCount,
|
|
serviceHandlerCount,
|
|
false, conf, namesystem.getDelegationTokenSecretManager());
|
|
false, conf, namesystem.getDelegationTokenSecretManager());
|
|
- this.serviceRpcServer.addProtocol(RpcKind.RPC_WRITABLE,
|
|
|
|
- RefreshAuthorizationPolicyProtocol.class, this);
|
|
|
|
- this.serviceRpcServer.addProtocol(RpcKind.RPC_WRITABLE,
|
|
|
|
- RefreshUserMappingsProtocol.class, this);
|
|
|
|
- this.serviceRpcServer.addProtocol(RpcKind.RPC_WRITABLE,
|
|
|
|
- GetUserMappingsProtocol.class, this);
|
|
|
|
DFSUtil.addPBProtocol(conf, NamenodeProtocolPB.class, NNPbService,
|
|
DFSUtil.addPBProtocol(conf, NamenodeProtocolPB.class, NNPbService,
|
|
serviceRpcServer);
|
|
serviceRpcServer);
|
|
DFSUtil.addPBProtocol(conf, DatanodeProtocolPB.class, dnProtoPbService,
|
|
DFSUtil.addPBProtocol(conf, DatanodeProtocolPB.class, dnProtoPbService,
|
|
serviceRpcServer);
|
|
serviceRpcServer);
|
|
-
|
|
|
|
|
|
+ DFSUtil.addPBProtocol(conf, RefreshAuthorizationPolicyProtocolPB.class,
|
|
|
|
+ refreshAuthService, serviceRpcServer);
|
|
|
|
+ DFSUtil.addPBProtocol(conf, RefreshUserMappingsProtocolPB.class,
|
|
|
|
+ refreshUserMappingService, serviceRpcServer);
|
|
|
|
+ DFSUtil.addPBProtocol(conf, GetUserMappingsProtocolPB.class,
|
|
|
|
+ getUserMappingService, serviceRpcServer);
|
|
|
|
+
|
|
this.serviceRPCAddress = this.serviceRpcServer.getListenerAddress();
|
|
this.serviceRPCAddress = this.serviceRpcServer.getListenerAddress();
|
|
nn.setRpcServiceServerAddress(conf, serviceRPCAddress);
|
|
nn.setRpcServiceServerAddress(conf, serviceRPCAddress);
|
|
} else {
|
|
} else {
|
|
@@ -199,16 +222,16 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
|
clientNNPbService, socAddr.getHostName(),
|
|
clientNNPbService, socAddr.getHostName(),
|
|
socAddr.getPort(), handlerCount, false, conf,
|
|
socAddr.getPort(), handlerCount, false, conf,
|
|
namesystem.getDelegationTokenSecretManager());
|
|
namesystem.getDelegationTokenSecretManager());
|
|
- this.clientRpcServer.addProtocol(RpcKind.RPC_WRITABLE,
|
|
|
|
- RefreshAuthorizationPolicyProtocol.class, this);
|
|
|
|
- this.clientRpcServer.addProtocol(RpcKind.RPC_WRITABLE,
|
|
|
|
- RefreshUserMappingsProtocol.class, this);
|
|
|
|
- this.clientRpcServer.addProtocol(RpcKind.RPC_WRITABLE,
|
|
|
|
- GetUserMappingsProtocol.class, this);
|
|
|
|
DFSUtil.addPBProtocol(conf, NamenodeProtocolPB.class, NNPbService,
|
|
DFSUtil.addPBProtocol(conf, NamenodeProtocolPB.class, NNPbService,
|
|
clientRpcServer);
|
|
clientRpcServer);
|
|
DFSUtil.addPBProtocol(conf, DatanodeProtocolPB.class, dnProtoPbService,
|
|
DFSUtil.addPBProtocol(conf, DatanodeProtocolPB.class, dnProtoPbService,
|
|
clientRpcServer);
|
|
clientRpcServer);
|
|
|
|
+ DFSUtil.addPBProtocol(conf, RefreshAuthorizationPolicyProtocolPB.class,
|
|
|
|
+ refreshAuthService, clientRpcServer);
|
|
|
|
+ DFSUtil.addPBProtocol(conf, RefreshUserMappingsProtocolPB.class,
|
|
|
|
+ refreshUserMappingService, clientRpcServer);
|
|
|
|
+ DFSUtil.addPBProtocol(conf, GetUserMappingsProtocolPB.class,
|
|
|
|
+ getUserMappingService, clientRpcServer);
|
|
|
|
|
|
// set service-level authorization security policy
|
|
// set service-level authorization security policy
|
|
if (serviceAuthEnabled =
|
|
if (serviceAuthEnabled =
|