Class AvailableSpaceResolver

java.lang.Object
org.apache.hadoop.hdfs.server.federation.resolver.order.RouterResolver<String,org.apache.hadoop.hdfs.server.federation.resolver.order.AvailableSpaceResolver.SubclusterAvailableSpace>
org.apache.hadoop.hdfs.server.federation.resolver.order.AvailableSpaceResolver
All Implemented Interfaces:
OrderedResolver

public class AvailableSpaceResolver extends RouterResolver<String,org.apache.hadoop.hdfs.server.federation.resolver.order.AvailableSpaceResolver.SubclusterAvailableSpace>
Order the destinations based on available space. This resolver uses a higher probability (instead of "always") to choose the cluster with higher available space.
  • Field Details

    • BALANCER_PREFERENCE_KEY

      public static final String BALANCER_PREFERENCE_KEY
      Increases chance of files on subcluster with more available space.
      See Also:
    • BALANCER_PREFERENCE_DEFAULT

      public static final float BALANCER_PREFERENCE_DEFAULT
      See Also:
  • Constructor Details

    • AvailableSpaceResolver

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

    • getSubclusterInfo

      protected Map<String,org.apache.hadoop.hdfs.server.federation.resolver.order.AvailableSpaceResolver.SubclusterAvailableSpace> getSubclusterInfo(MembershipStore membershipStore)
      Get the mapping from NamespaceId to subcluster space info. 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,org.apache.hadoop.hdfs.server.federation.resolver.order.AvailableSpaceResolver.SubclusterAvailableSpace>
      Parameters:
      membershipStore - Membership store the resolver queried from.
      Returns:
      NamespaceId to AvailableSpaceResolver.SubclusterAvailableSpace.
    • chooseFirstNamespace

      protected String chooseFirstNamespace(String path, PathLocation loc)
      Description copied from class: RouterResolver
      Choose the first namespace from queried subcluster mapping info.
      Specified by:
      chooseFirstNamespace in class RouterResolver<String,org.apache.hadoop.hdfs.server.federation.resolver.order.AvailableSpaceResolver.SubclusterAvailableSpace>
      Parameters:
      path - Path to check.
      loc - Federated location with multiple destinations.
      Returns:
      First namespace out of the locations.