Class BalancerConditionals
java.lang.Object
org.apache.hadoop.hbase.master.balancer.BalancerConditionals
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
@Private
final class BalancerConditionals
extends Object
implements org.apache.hadoop.conf.Configurable
Balancer conditionals supplement cost functions in the
StochasticLoadBalancer. Cost
functions are insufficient and difficult to work with when making discrete decisions; this is
because they operate on a continuous scale, and each cost function's multiplier affects the
relative importance of every other cost function. So it is difficult to meaningfully and clearly
value many aspects of your region distribution via cost functions alone. Conditionals allow you
to very clearly define discrete rules that your balancer would ideally follow. To clarify, a
conditional violation will not block a region assignment because we would prefer to have uptime
than have perfectly intentional balance. But conditionals allow you to, for example, define that
a region's primary and secondary should not live on the same rack. Another example, conditionals
make it easy to define that system tables will ideally be isolated on their own RegionServer
(without needing to manage distinct RegionServer groups).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprivate Set<Class<? extends RegionPlanConditional>>private Set<RegionPlanConditional>private org.apache.hadoop.conf.Configurationstatic final booleanstatic final Stringstatic final booleanstatic final Stringstatic final booleanstatic final Stringprivate static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void(package private) static BalancerConditionalscreate()private RegionPlanConditionalcreateConditional(Class<? extends RegionPlanConditional> clazz, BalancerClusterState cluster) (package private) Set<Class<? extends RegionPlanConditional>>(package private) Collection<RegionPlanConditional>org.apache.hadoop.conf.ConfigurationgetConf()(package private) intgetViolationCountChange(BalancerClusterState cluster, BalanceAction action) Indicates whether the action is good for our conditional compliance.(package private) boolean(package private) boolean(package private) boolean(package private) booleanisServerHostingIsolatedTables(BalancerClusterState cluster, int serverIdx) (package private) boolean(package private) booleanisViolating(BalancerClusterState cluster, BalanceAction action) Check if the proposed action violates conditionalsprivate booleanisViolating(RegionPlan regionPlan) (package private) voidloadClusterState(BalancerClusterState cluster) voidsetConf(org.apache.hadoop.conf.Configuration conf) (package private) booleanshouldRunBalancer(BalancerClusterState cluster)
-
Field Details
-
LOG
-
DISTRIBUTE_REPLICAS_KEY
- See Also:
-
DISTRIBUTE_REPLICAS_DEFAULT
- See Also:
-
ISOLATE_META_TABLE_KEY
- See Also:
-
ISOLATE_META_TABLE_DEFAULT
- See Also:
-
ISOLATE_SYSTEM_TABLES_KEY
- See Also:
-
ISOLATE_SYSTEM_TABLES_DEFAULT
- See Also:
-
ADDITIONAL_CONDITIONALS_KEY
- See Also:
-
conditionalClasses
-
conditionals
-
conf
-
-
Constructor Details
-
BalancerConditionals
private BalancerConditionals()
-
-
Method Details
-
create
-
shouldRunBalancer
-
getConditionalClasses
Set<Class<? extends RegionPlanConditional>> getConditionalClasses() -
getConditionals
-
isReplicaDistributionEnabled
boolean isReplicaDistributionEnabled() -
isTableIsolationEnabled
boolean isTableIsolationEnabled() -
isMetaTableIsolationEnabled
boolean isMetaTableIsolationEnabled() -
isServerHostingIsolatedTables
-
isConditionalBalancingEnabled
boolean isConditionalBalancingEnabled() -
clearConditionalWeightCaches
void clearConditionalWeightCaches() -
loadClusterState
-
getViolationCountChange
Indicates whether the action is good for our conditional compliance.- Parameters:
cluster- The cluster stateaction- The proposed action- Returns:
- -1 if conditionals improve, 0 if neutral, 1 if conditionals degrade
-
isViolating
Check if the proposed action violates conditionals- Parameters:
cluster- The cluster stateaction- The proposed action
-
isViolating
-
createConditional
private RegionPlanConditional createConditional(Class<? extends RegionPlanConditional> clazz, BalancerClusterState cluster) -
setConf
- Specified by:
setConfin interfaceorg.apache.hadoop.conf.Configurable
-
getConf
- Specified by:
getConfin interfaceorg.apache.hadoop.conf.Configurable
-