public class CellAwareGoal extends AbstractGoal
balancingConstraint, finished, minMonitoredPartitionPercentage, numWindows, optimizationResultBuilder, proposalStatsBuilder
Constructor and Description |
---|
CellAwareGoal() |
Modifier and Type | Method and Description |
---|---|
protected SortedSet<Broker> |
brokersToBalance(ClusterModel clusterModel)
Get sorted brokers that the rebalance process will go over to apply balancing actions to replicas they contain.
|
boolean |
canChangeReplicationFactor()
True if this goal can change replication factor of a topic
|
static void |
cellBoundariesAreMet(ClusterModel clusterModel,
Set<String> excludedTopics) |
ModelCompletenessRequirements |
clusterModelCompletenessRequirements()
Specify the load requirements 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)
Make sure that all non-excluded topics have replication factor smaller than the size of the largest cell.
|
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)
Accept iff all replica brokers will be in the same cell after the move
|
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 sourceBroker,
ClusterModel clusterModel,
Set<Goal> optimizedGoals,
OptimizationOptions optimizationOptions)
For each replica in the broker, if the replicas of its partition are not all in the same cell, try to move them
to the leader cell.
|
ActionAcceptance |
replicaActionAcceptance(ReplicaBalancingAction action,
ClusterModel clusterModel)
Accept iff partition has only one replica, or if destination cell is same as source cell.
|
boolean |
replicaActionSelfSatisfied(ClusterModel clusterModel,
ReplicaBalancingAction action)
Check if requirements of this goal are not violated if this replica action is applied
to the given cluster state, false otherwise.
|
protected void |
updateGoalState(ClusterModel clusterModel,
Set<String> excludedTopics)
Validate that all non-excluded partitions are in the same cell
|
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, clusterModelStatsComparator, optimize
public ActionAcceptance replicaActionAcceptance(ReplicaBalancingAction action, ClusterModel clusterModel)
action
- Action to be checked for acceptance.clusterModel
- State of the cluster before application of the action.public ActionAcceptance partitionActionAcceptance(PartitionBalancingAction action, ClusterModel clusterModel)
action
- Action to be checked for acceptance.clusterModel
- State of the cluster before application of the action.public ModelCompletenessRequirements clusterModelCompletenessRequirements()
Goal
public String name()
Goal
name
in interface Goal
name
in class AbstractGoal
public void finish()
Goal
public boolean canChangeReplicationFactor()
Goal
public boolean isHardGoal()
Goal
protected SortedSet<Broker> brokersToBalance(ClusterModel clusterModel)
AbstractGoal
brokersToBalance
in class AbstractGoal
clusterModel
- The state of the cluster.public boolean replicaActionSelfSatisfied(ClusterModel clusterModel, ReplicaBalancingAction action)
GoalBalancingActionAcceptance
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 initGoalState(ClusterModel clusterModel, OptimizationOptions optimizationOptions, Optional<OptimizationMetrics> optimizationMetricsOpt) throws OptimizationFailureException
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.OptimizationFailureException
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
protected void rebalanceForBroker(Broker sourceBroker, ClusterModel clusterModel, Set<Goal> optimizedGoals, OptimizationOptions optimizationOptions) throws OptimizationFailureException
rebalanceForBroker
in class AbstractGoal
sourceBroker
- 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.OptimizationFailureException
public static void cellBoundariesAreMet(ClusterModel clusterModel, Set<String> excludedTopics) throws OptimizationFailureException
OptimizationFailureException