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.
NamenodeHeartbeatService to register a discovered NN.-
Method Summary
Modifier and TypeMethodDescriptionGet a list of all namespaces that are disabled.List<? extends FederationNamenodeContext>getNamenodesForBlockPoolId(String blockPoolId) Returns a prioritized list of the most recent cached registration entries for a single block pool ID.List<? extends FederationNamenodeContext>getNamenodesForNameserviceId(String nameserviceId, boolean listObserversFirst) Returns a prioritized list of the most recent cached registration entries for a single nameservice ID.Get a list of all namespaces that are registered and active in the federation.booleanregisterNamenode(NamenodeStatusReport report) Register a namenode in the State Store.voidrotateCache(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.voidsetRouterId(String routerId) Assign a unique identifier for the parent router service.voidupdateActiveNamenode(String ns, InetSocketAddress successfulAddress) Report a successful, active NN address for a nameservice or blockPool.voidupdateUnavailableNamenode(String ns, InetSocketAddress failedAddress) Report a failed, unavailable NN address for a nameservice or blockPool.
-
Method Details
-
updateActiveNamenode
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
- 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
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
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
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
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
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 idnamenode- namenode contextslistObserversFirst- Observer read case, observer NN will be ranked first