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 String
private Set<Class<? extends RegionPlanConditional>>
private Set<RegionPlanConditional>
private org.apache.hadoop.conf.Configuration
static final boolean
static final String
static final boolean
static final String
private static final org.slf4j.Logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
(package private) static BalancerConditionals
create()
private RegionPlanConditional
createConditional
(Class<? extends RegionPlanConditional> clazz, BalancerClusterState cluster) (package private) Set<Class<? extends RegionPlanConditional>>
(package private) Collection<RegionPlanConditional>
org.apache.hadoop.conf.Configuration
getConf()
(package private) int
getViolationCountChange
(BalancerClusterState cluster, BalanceAction action) Indicates whether the action is good for our conditional compliance.(package private) boolean
(package private) boolean
(package private) boolean
isServerHostingIsolatedTables
(BalancerClusterState cluster, int serverIdx) (package private) boolean
(package private) boolean
isViolating
(BalancerClusterState cluster, BalanceAction action) Check if the proposed action violates conditionalsprivate boolean
isViolating
(RegionPlan regionPlan) (package private) void
loadClusterState
(BalancerClusterState cluster) void
setConf
(org.apache.hadoop.conf.Configuration conf) (package private) boolean
shouldRunBalancer
(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:
-
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() -
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:
setConf
in interfaceorg.apache.hadoop.conf.Configurable
-
getConf
- Specified by:
getConf
in interfaceorg.apache.hadoop.conf.Configurable
-