java.lang.Object
org.apache.hadoop.hdfs.server.federation.resolver.order.HashResolver
All Implemented Interfaces:
OrderedResolver
Direct Known Subclasses:
HashFirstResolver

public class HashResolver extends Object implements OrderedResolver
Order the destinations based on consistent hashing.
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
  • Constructor Details

    • HashResolver

      public HashResolver()
  • Method Details

    • getFirstNamespace

      public String getFirstNamespace(String path, PathLocation loc)
      Use the result from consistent hashing locator to prioritize the locations for a path.
      Specified by:
      getFirstNamespace in interface OrderedResolver
      Parameters:
      path - Path to check.
      loc - Federated location with multiple destinations.
      Returns:
      First namespace based on hash.
    • extractTempFileName

      @VisibleForTesting public static String extractTempFileName(String input)
      Some files use a temporary naming pattern. Extract the final name from the temporary name. For example, files *._COPYING_ will be renamed, so we remove that chunk.
      Parameters:
      input - Input string.
      Returns:
      Final file name.