public class ReplicaPlacementGoal extends AbstractGoal
Goal.ClusterModelStatsComparator
_balancingConstraint, _finished, _minMonitoredPartitionPercentage, _numWindows, _succeeded
Constructor and Description |
---|
ReplicaPlacementGoal() |
Modifier and Type | Method and Description |
---|---|
ActionAcceptance |
actionAcceptance(BalancingAction action,
ClusterModel clusterModel)
Assuming that the cluster already satisfies replica placement constraints, then:
Replica movement from broker A to broker B is accepted in two cases
1.
|
protected java.util.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
|
ModelCompletenessRequirements |
clusterModelCompletenessRequirements()
Specify the load requirements for this goal.
|
Goal.ClusterModelStatsComparator |
clusterModelStatsComparator()
Get an instance of
Goal.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)
Sanity check:
There must be at least enough brokers matching a particular constraint across both replicas and observers.
|
boolean |
isHardGoal()
True if this is a hard goal, false otherwise.
|
java.lang.String |
name()
Get the name of this goal.
|
protected void |
rebalanceForBroker(Broker broker,
ClusterModel clusterModel,
java.util.Set<Goal> optimizedGoals,
OptimizationOptions optimizationOptions)
Try to rebalance each broker by moving any replicas that exceed the total number of partition replicas for a rack
to a rack with unsatisfied constraints.
|
protected boolean |
selfSatisfied(ClusterModel clusterModel,
BalancingAction 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,
java.util.Set<java.lang.String> excludedTopics)
Validate that all topic placements have been satisfied.
|
configure, maybeApplyBalancingAction, maybeMoveReplicaBetweenDisks, optimize, shouldExclude, toString
public ActionAcceptance actionAcceptance(BalancingAction action, ClusterModel clusterModel)
action
- Action to be checked for acceptance.clusterModel
- State of the cluster before application of the action.public Goal.ClusterModelStatsComparator clusterModelStatsComparator()
Goal
Goal.ClusterModelStatsComparator
for this goal.
The Goal.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 java.lang.String name()
Goal
name
in interface Goal
name
in class AbstractGoal
public void finish()
Goal
public boolean canChangeReplicationFactor()
Goal
public boolean isHardGoal()
Goal
protected java.util.SortedSet<Broker> brokersToBalance(ClusterModel clusterModel)
AbstractGoal
brokersToBalance
in class AbstractGoal
clusterModel
- The state of the cluster.protected boolean selfSatisfied(ClusterModel clusterModel, BalancingAction action)
AbstractGoal
selfSatisfied
in class AbstractGoal
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) throws OptimizationFailureException
initGoalState
in class AbstractGoal
clusterModel
- The state of the cluster.optimizationOptions
- Options to take into account during optimization -- e.g. excluded topics.OptimizationFailureException
protected void updateGoalState(ClusterModel clusterModel, java.util.Set<java.lang.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 broker, ClusterModel clusterModel, java.util.Set<Goal> optimizedGoals, OptimizationOptions optimizationOptions) throws OptimizationFailureException
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.OptimizationFailureException