MultipleDestinationMountTableResolver (Apache Hadoop HDFS-RBF 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.server.federation.resolver, class: MultipleDestinationMountTableResolver

Package org.apache.hadoop.hdfs.server.federation.resolver

# Class MultipleDestinationMountTableResolver

java.lang.Object
org.apache.hadoop.hdfs.server.federation.resolver.MountTableResolver
org.apache.hadoop.hdfs.server.federation.resolver.MultipleDestinationMountTableResolver

All Implemented Interfaces:
  `FileSubclusterResolver`, `StateStoreCache`

public class MultipleDestinationMountTableResolver extends MountTableResolver
Mount table resolver that supports multiple locations for each mount entry. The returned location contains prioritized remote paths from highest priority to the lowest priority. Multiple locations for a mount point are optional. When multiple locations are specified, both will be checked for the presence of a file and the nameservice for a new file/dir is chosen based on the results of a consistent hashing algorithm.

Does the Mount table entry for this path have multiple destinations?

- No: Return the location
- Yes: Return all locations, prioritizing the best guess from the consistent hashing algorithm.

It has multiple options to order the locations: HASH (default), LOCAL, RANDOM, and HASH_ALL.

The consistent hashing result is dependent on the number and combination of nameservices that are registered for particular mount point. The order of nameservices/locations in the mount table is not prioritized. Each consistent hash calculation considers only the set of unique nameservices present for the mount table location.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MultipleDestinationMountTableResolver(org.apache.hadoop.conf.Configuration conf, Router router)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addResolver(DestinationOrder order, OrderedResolver resolver)`
  `PathLocation`
  `getDestinationForPath(String path)`
  Get the destinations for a global path.
  `OrderedResolver`
  `getOrderedResolver(DestinationOrder order)`

  ### Methods inherited from class org.apache.hadoop.hdfs.server.federation.resolver.MountTableResolver

  `addEntry, clear, getCacheSize, getDefaultNameService, getDefaultNamespace, getLocCacheAccess, getLocCacheMiss, getMountPoint, getMountPoints, getMounts, getMountTableStore, getRouter, getTrashRoot, isDefaultNSEnable, isTrashPath, loadCache, lookupLocation, refreshEntries, removeEntry, setDefaultNameService, setDefaultNSEnable, setDisabled, subtractTrashCurrentPath, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### MultipleDestinationMountTableResolver

    public MultipleDestinationMountTableResolver(org.apache.hadoop.conf.Configuration conf, Router router)

- ## Method Details

  - ### getDestinationForPath

    public PathLocation getDestinationForPath(String path) throws IOException
    Description copied from interface: `FileSubclusterResolver`
    Get the destinations for a global path. Results are from the mount table cache. If multiple destinations are available, the first result is the highest priority destination.
    Specified by:
      `getDestinationForPath` in interface `FileSubclusterResolver`
    Overrides:
      `getDestinationForPath` in class `MountTableResolver`
    Parameters:
      `path` - Global path.
    Returns:
      Location in a destination namespace or null if it does not exist.
    Throws:
      `IOException` - Throws exception if the data is not available.

  - ### addResolver

    @VisibleForTesting public void addResolver(DestinationOrder order, OrderedResolver resolver)

  - ### getOrderedResolver

    @VisibleForTesting public OrderedResolver getOrderedResolver(DestinationOrder order)