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 Summary
FieldsModifier and TypeFieldDescriptionstatic final floatstatic final StringIncreases chance of files on subcluster with more available space.Fields inherited from class org.apache.hadoop.hdfs.server.federation.resolver.order.RouterResolver
MIN_UPDATE_PERIOD_KEY -
Constructor Summary
ConstructorsConstructorDescriptionAvailableSpaceResolver(org.apache.hadoop.conf.Configuration conf, Router routerService) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringchooseFirstNamespace(String path, PathLocation loc) Choose the first namespace from queried subcluster mapping info.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.Methods inherited from class org.apache.hadoop.hdfs.server.federation.resolver.order.RouterResolver
getFirstNamespace, getMembershipStore, getRpcServer, getSubclusterMapping
-
Field Details
-
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
-
-
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:
getSubclusterInfoin classRouterResolver<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
Description copied from class:RouterResolverChoose the first namespace from queried subcluster mapping info.- Specified by:
chooseFirstNamespacein classRouterResolver<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.
-