public abstract class IncrementalResourceDistributionGoal extends ResourceDistributionAbstractGoal
Resource
distribution over brokers incrementally.ResourceDistributionAbstractGoal.ChangeType
fixOfflineReplicasOnly, initialResourceDistribution, moveImmigrantsOnly, requireLessLoad, requireMoreLoad, thresholds
balancingConstraint, finished, minMonitoredPartitionPercentage, numWindows, optimizationResultBuilder, proposalStatsBuilder
Constructor and Description |
---|
IncrementalResourceDistributionGoal() |
Modifier and Type | Method and Description |
---|---|
protected SortedSet<Broker> |
brokersToBalance(ClusterModel clusterModel)
Retrieves the brokers to be balanced sorted by their resource utilization in descending order.
|
ModelCompletenessRequirements |
clusterModelCompletenessRequirements()
Specify the load requirements for this goal.
|
void |
configure(Map<String,?> configs)
Configure this class with the given key-value pairs
|
protected void |
doRebalance(Broker broker,
ClusterModel clusterModel,
Set<Goal> optimizedGoals,
OptimizationOptions optimizationOptions)
(1) REBALANCE BY REPLICA MOVEMENT: Perform optimization via replica movement for the given resource (without
breaking the balance for already balanced resources) to ensure rebalance: The load on brokers for the given
resource is under the balance limit.
|
protected void |
initGoalState(ClusterModel clusterModel,
OptimizationOptions optimizationOptions,
Optional<OptimizationMetrics> optimizationMetricsOpt)
Initialize the state of this goal.
|
protected boolean |
isRebalanceByMovingLoadInCompleted(Broker broker) |
protected boolean |
isRebalanceByMovingLoadOutCompleted(Broker broker) |
ActionAcceptance |
replicaActionAcceptance(ReplicaBalancingAction action,
ClusterModel clusterModel)
Check whether given action is acceptable by this goal.
|
boolean |
replicaActionSelfSatisfied(ClusterModel clusterModel,
ReplicaBalancingAction action)
Check if requirements of this goal are not violated if this action is applied to the given cluster state.
|
protected void |
updateGoalState(ClusterModel clusterModel,
Set<String> excludedTopics)
Marks the balance as completed after one round of balancing if there are no offline replicas.
|
clusterModelStatsComparator, finish, isHardGoal, isLoadAboveBalanceLowerLimit, isLoadAboveBalanceLowerLimitAfterChange, isLoadUnderBalanceUpperLimit, isLoadUnderBalanceUpperLimitAfterChange, name, partitionActionAcceptance, partitionActionSelfSatisfied, performLeadershipMovement, performReplicaMovement, rebalanceForBroker, resource, sortName, validatePercentages
changeObservership, maybeApplyBalancingAction, maybeApplyBalancingAction, maybeMoveReplicaBetweenDisks, optimize, proposalTrackingOptions, relocateReplica, selfSatisfied, shouldExclude, shouldExclude, shouldTryLeadershipMovement, toString, tryAcceptProposal, updateReplicationFactor
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
actionAcceptance, canChangeReplicationFactor, optimize
public void configure(Map<String,?> configs)
CruiseControlConfigurable
configure
in interface CruiseControlConfigurable
configure
in class AbstractGoal
public ModelCompletenessRequirements clusterModelCompletenessRequirements()
Goal
clusterModelCompletenessRequirements
in interface Goal
clusterModelCompletenessRequirements
in class ResourceDistributionAbstractGoal
protected void initGoalState(ClusterModel clusterModel, OptimizationOptions optimizationOptions, Optional<OptimizationMetrics> optimizationMetricsOpt) throws OptimizationFailureException
ResourceDistributionAbstractGoal
initGoalState
in class ResourceDistributionAbstractGoal
clusterModel
- The state of the cluster.optimizationOptions
- Options to take into account during optimization -- e.g. excluded topics.optimizationMetricsOpt
- An optional of OptimizationMetrics
used to capture various metrics throughout
this goal's optimization run.OptimizationFailureException
- when optimization encounters failurepublic ActionAcceptance replicaActionAcceptance(ReplicaBalancingAction action, ClusterModel clusterModel)
action
- Action to be checked for acceptance.clusterModel
- The state of the cluster.ActionAcceptance.ACCEPT
if the action is acceptable by this goal,
ActionAcceptance.REPLICA_REJECT
otherwise.protected SortedSet<Broker> brokersToBalance(ClusterModel clusterModel)
brokersToBalance
in class AbstractGoal
clusterModel
- The state of the cluster.public boolean replicaActionSelfSatisfied(ClusterModel clusterModel, ReplicaBalancingAction action)
clusterModel
- The state of the cluster.action
- Action containing information about potential modification to the given cluster model.protected void updateGoalState(ClusterModel clusterModel, Set<String> excludedTopics) throws OptimizationFailureException
updateGoalState
in class AbstractGoal
clusterModel
- The state of the cluster.excludedTopics
- The topics that should be excluded from the optimization action.OptimizationFailureException
- when optimization encounters failureprotected boolean isRebalanceByMovingLoadOutCompleted(Broker broker)
isRebalanceByMovingLoadOutCompleted
in class ResourceDistributionAbstractGoal
protected boolean isRebalanceByMovingLoadInCompleted(Broker broker)
isRebalanceByMovingLoadInCompleted
in class ResourceDistributionAbstractGoal
protected void doRebalance(Broker broker, ClusterModel clusterModel, Set<Goal> optimizedGoals, OptimizationOptions optimizationOptions)
(2) REBALANCE BY LEADERSHIP MOVEMENT: Perform optimization via leadership reassign for the given resource to ensure rebalance: The load on brokers for the given resource is under the balance limit.
doRebalance
in class ResourceDistributionAbstractGoal
broker
- Broker to be balanced.clusterModel
- The state of the cluster.optimizedGoals
- Optimized goals.optimizationOptions
- Options to take into account during optimization -- e.g. excluded topics.