Interface ActiveNamenodeResolver

All Known Implementing Classes:
MembershipNamenodeResolver

@Private @Evolving public interface ActiveNamenodeResolver
Locates the most active NN for a given nameservice ID or blockpool ID. This interface is used by the RouterRpcServer to:
  • Determine the target NN for a given subcluster.
  • List of all namespaces discovered/active in the federation.
  • Update the currently active NN empirically.
The interface is also used by the NamenodeHeartbeatService to register a discovered NN.
  • Method Details

    • updateUnavailableNamenode

      void updateUnavailableNamenode(String ns, InetSocketAddress failedAddress) throws IOException
      Report a failed, unavailable NN address for a nameservice or blockPool.
      Parameters:
      ns - Nameservice identifier.
      failedAddress - The address the failed responded to the command.
      Throws:
      IOException - If the state store cannot be accessed.
    • updateActiveNamenode

      void updateActiveNamenode(String ns, InetSocketAddress successfulAddress) throws IOException
      Report a successful, active NN address for a nameservice or blockPool.
      Parameters:
      ns - Nameservice identifier.
      successfulAddress - The address the successful responded to the command.
      Throws:
      IOException - If the state store cannot be accessed.
    • getNamenodesForNameserviceId

      List<? extends FederationNamenodeContext> getNamenodesForNameserviceId(String nameserviceId, boolean listObserversFirst) throws IOException
      Returns a prioritized list of the most recent cached registration entries for a single nameservice ID. Returns an empty list if none are found. In the case of not observerRead Returns entries in preference of :
      • The most recent ACTIVE NN
      • The most recent OBSERVER NN
      • The most recent STANDBY NN
      • The most recent UNAVAILABLE NN
      In the case of observerRead Returns entries in preference of :
      • The most recent OBSERVER NN
      • The most recent ACTIVE NN
      • The most recent STANDBY NN
      • The most recent UNAVAILABLE NN
      Parameters:
      nameserviceId - Nameservice identifier.
      listObserversFirst - Observer read case, observer NN will be ranked first
      Returns:
      Prioritized list of namenode contexts.
      Throws:
      IOException - If the state store cannot be accessed.
    • getNamenodesForBlockPoolId

      List<? extends FederationNamenodeContext> getNamenodesForBlockPoolId(String blockPoolId) throws IOException
      Returns a prioritized list of the most recent cached registration entries for a single block pool ID. Returns an empty list if none are found. Returns entries in preference of:
      • The most recent ACTIVE NN
      • The most recent OBSERVER NN
      • The most recent STANDBY NN
      • The most recent UNAVAILABLE NN
      Parameters:
      blockPoolId - Block pool identifier for the nameservice.
      Returns:
      Prioritized list of namenode contexts.
      Throws:
      IOException - If the state store cannot be accessed.
    • registerNamenode

      boolean registerNamenode(NamenodeStatusReport report) throws IOException
      Register a namenode in the State Store.
      Parameters:
      report - Namenode status report.
      Returns:
      True if the node was registered and successfully committed to the data store.
      Throws:
      IOException - Throws exception if the namenode could not be registered.
    • getNamespaces

      Set<FederationNamespaceInfo> getNamespaces() throws IOException
      Get a list of all namespaces that are registered and active in the federation.
      Returns:
      List of name spaces in the federation
      Throws:
      IOException - Throws exception if the namespace list is not available.
    • getDisabledNamespaces

      Set<String> getDisabledNamespaces() throws IOException
      Get a list of all namespaces that are disabled.
      Returns:
      List of name spaces identifier in the federation
      Throws:
      IOException - If the disabled list is not available.
    • setRouterId

      void setRouterId(String routerId)
      Assign a unique identifier for the parent router service. Required to report the status to the namenode resolver.
      Parameters:
      routerId - Unique string identifier for the router.
    • rotateCache

      void rotateCache(String nsId, FederationNamenodeContext namenode, boolean listObserversFirst)
      Rotate cache, make the current namenode have the lowest priority, to ensure that the current namenode will not be accessed first next time.
      Parameters:
      nsId - name service id
      namenode - namenode contexts
      listObserversFirst - Observer read case, observer NN will be ranked first