public class TopicReplicaDistributionGoal extends AbstractGoal
Make sure that for all topics it's true that the leaders and followers are within the bounds defined by the average leader/follower replica per-broker and the balancing percentage.
Also see: KafkaCruiseControlConfig.TOPIC_BALANCING_BALANCE_THRESHOLD_MULTIPLIER_CONFIG
,
KafkaCruiseControlConfig.TOPIC_BALANCING_TRIGGER_THRESHOLD_MULTIPLIER_CONFIG
,
and balancePercentage(OptimizationOptions)
.
Constructor and Description |
---|
TopicReplicaDistributionGoal()
Constructor for Replica Distribution Goal.
|
TopicReplicaDistributionGoal(BalancingConstraint balancingConstraint) |
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
ActionAcceptance |
replicaActionAcceptance(ReplicaBalancingAction action,
ClusterModel clusterModel)
Check whether the given action is acceptable by this goal.
|
boolean |
replicaActionSelfSatisfied(ClusterModel clusterModel,
ReplicaBalancingAction action)
Check if requirements of this goal are not violated if this proposal is applied to the given cluster state,
false otherwise.
|
configure, optimize, selfSatisfied, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
actionAcceptance, canChangeReplicationFactor, optimize
public TopicReplicaDistributionGoal()
public TopicReplicaDistributionGoal(BalancingConstraint balancingConstraint)
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 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 boolean isHardGoal()
Goal
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. Assumed to be
of type ActionType.INTER_BROKER_REPLICA_MOVEMENT
.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.public void finish()
Goal