Class LocalResolver
java.lang.Object
org.apache.hadoop.hdfs.server.federation.resolver.order.RouterResolver<String,String>
org.apache.hadoop.hdfs.server.federation.resolver.order.LocalResolver
- All Implemented Interfaces:
OrderedResolver
The local subcluster (where the writer is) should be tried first. The writer
is defined from the RPC query received in the RPC server.
-
Field Summary
Fields inherited from class org.apache.hadoop.hdfs.server.federation.resolver.order.RouterResolver
MIN_UPDATE_PERIOD_KEY -
Constructor Summary
ConstructorsConstructorDescriptionLocalResolver(org.apache.hadoop.conf.Configuration conf, Router routerService) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringchooseFirstNamespace(String path, PathLocation loc) Get the local name space.Get the Datanode mapping from the subclusters from the Namenodes.getSubclusterInfo(MembershipStore membershipStore) Get the mapping from nodes to subcluster.Methods inherited from class org.apache.hadoop.hdfs.server.federation.resolver.order.RouterResolver
getFirstNamespace, getMembershipStore, getRpcServer, getSubclusterMapping
-
Constructor Details
-
LocalResolver
-
-
Method Details
-
getSubclusterInfo
Get the mapping from nodes to subcluster. It gets this mapping from the subclusters through expensive calls (e.g., RPC) and uses caching to avoid too many calls. The cache might be updated asynchronously to reduce latency.- Specified by:
getSubclusterInfoin classRouterResolver<String,String> - Parameters:
membershipStore- Membership store the resolver queried from.- Returns:
- Node IP to Subcluster.
-
chooseFirstNamespace
Get the local name space. This relies on the RPC Server to get the address from the client. TODO we only support DN and NN locations, we need to add others like Resource Managers.- Specified by:
chooseFirstNamespacein classRouterResolver<String,String> - Parameters:
path- Path ignored by this policy.loc- Federated location with multiple destinations.- Returns:
- Local name space. Null if we don't know about this machine.
-
getDatanodesSubcluster
Get the Datanode mapping from the subclusters from the Namenodes. This needs to be done as a privileged action to use the user for the Router and not the one from the client in the RPC call.- Returns:
- DN IP -> Subcluster.
-