public class IntraBrokerDiskUsageDistributionGoal extends AbstractGoal
balancingConstraint, finished, minMonitoredPartitionPercentage, numWindows, optimizationResultBuilder, proposalStatsBuilder
Constructor and Description |
---|
IntraBrokerDiskUsageDistributionGoal()
Constructor for Resource Distribution Goal.
|
Modifier and Type | Method and Description |
---|---|
protected SortedSet<Broker> |
brokersToBalance(ClusterModel clusterModel)
Get brokers in the cluster so that the rebalance process will go over to apply balancing actions to replicas
they contain.
|
ModelCompletenessRequirements |
clusterModelCompletenessRequirements()
Specify the load requirements for this goal.
|
ClusterModelStatsComparator |
clusterModelStatsComparator()
Get an instance of
ClusterModelStatsComparator for this goal. |
void |
finish()
Signal for finishing the process for rebalance or self-healing for this goal.
|
protected void |
initGoalState(ClusterModel clusterModel,
OptimizationOptions optimizationOptions,
Optional<OptimizationMetrics> optimizationMetricsOpt)
Initialize the utilization thresholds.
|
boolean |
isHardGoal()
True if this is a hard goal, false otherwise.
|
String |
name()
Get the name of this goal.
|
ActionAcceptance |
partitionActionAcceptance(PartitionBalancingAction action,
ClusterModel clusterModel)
Checks if the action on the partition specified by the
PartitionBalancingAction
is acceptable. |
boolean |
partitionActionSelfSatisfied(ClusterModel clusterModel,
PartitionBalancingAction action)
Check if requirements of this goal are not violated if this partition action is applied
to the given cluster state, false otherwise.
|
protected void |
rebalanceForBroker(Broker broker,
ClusterModel clusterModel,
Set<Goal> optimizedGoals,
OptimizationOptions optimizationOptions)
(1) REBALANCE BY REPLICA MOVEMENT:
Perform optimization via replica movement between disks to ensure balance: The load on disks are within range.
|
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, false otherwise.
|
protected void |
updateGoalState(ClusterModel clusterModel,
Set<String> excludedTopics)
Update goal state.
|
changeObservership, configure, 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 IntraBrokerDiskUsageDistributionGoal()
public boolean isHardGoal()
Goal
protected void initGoalState(ClusterModel clusterModel, OptimizationOptions optimizationOptions, Optional<OptimizationMetrics> optimizationMetricsOpt)
initGoalState
in class AbstractGoal
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.protected void updateGoalState(ClusterModel clusterModel, Set<String> excludedTopics)
updateGoalState
in class AbstractGoal
clusterModel
- The state of the cluster.excludedTopics
- The topics that should be excluded from the optimization action.protected SortedSet<Broker> brokersToBalance(ClusterModel clusterModel)
brokersToBalance
in class AbstractGoal
clusterModel
- The state of the cluster.public 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.public ActionAcceptance partitionActionAcceptance(PartitionBalancingAction action, ClusterModel clusterModel)
GoalBalancingActionAcceptance
PartitionBalancingAction
is acceptable.
For performance optimization purposes, it is recommended goals return the wider-level action acceptance first
(e.g ActionAcceptance.BROKER_REJECT
versus ActionAcceptance.REPLICA_REJECT
) as that helps
the proposal-generating logic short-circuit invalid proposal generations.action
- Action to be checked for acceptance.clusterModel
- State of the cluster before application of the action.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.public boolean partitionActionSelfSatisfied(ClusterModel clusterModel, PartitionBalancingAction action)
GoalBalancingActionAcceptance
clusterModel
- The state of the cluster.action
- Action containing information about potential modification to the given cluster model.protected void rebalanceForBroker(Broker broker, ClusterModel clusterModel, Set<Goal> optimizedGoals, OptimizationOptions optimizationOptions)
rebalanceForBroker
in class AbstractGoal
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.public ClusterModelStatsComparator clusterModelStatsComparator()
Goal
ClusterModelStatsComparator
for this goal.
The ClusterModelStatsComparator.compare(ClusterModelStats, ClusterModelStats)
method should give a
preference between two ClusterModelStats
.
Cruise Control will not reuse the returned instance.
The returned value must not be null.public ModelCompletenessRequirements clusterModelCompletenessRequirements()
Goal
public String name()
name
in interface Goal
name
in class AbstractGoal
public void finish()
Goal