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

public class LocalResolver extends RouterResolver<String,String>
The local subcluster (where the writer is) should be tried first. The writer is defined from the RPC query received in the RPC server.
  • Constructor Details

    • LocalResolver

      public LocalResolver(org.apache.hadoop.conf.Configuration conf, Router routerService)
  • Method Details

    • getSubclusterInfo

      protected Map<String,String> getSubclusterInfo(MembershipStore membershipStore)
      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:
      getSubclusterInfo in class RouterResolver<String,String>
      Parameters:
      membershipStore - Membership store the resolver queried from.
      Returns:
      Node IP to Subcluster.
    • chooseFirstNamespace

      protected String chooseFirstNamespace(String path, PathLocation loc)
      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:
      chooseFirstNamespace in class RouterResolver<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

      public Map<String,String> 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.