public class KafkaAssignerEvenRackAwareGoal extends java.lang.Object implements Goal
Goal.ClusterModelStatsComparator
Constructor and Description |
---|
KafkaAssignerEvenRackAwareGoal() |
Modifier and Type | Method and Description |
---|---|
ActionAcceptance |
actionAcceptance(BalancingAction action,
ClusterModel clusterModel)
Check whether the given action is acceptable by this goal.
|
ModelCompletenessRequirements |
clusterModelCompletenessRequirements()
Specify the load requirements for this goal.
|
Goal.ClusterModelStatsComparator |
clusterModelStatsComparator()
Get an instance of
Goal.ClusterModelStatsComparator for this goal. |
void |
configure(java.util.Map<java.lang.String,?> configs)
Configure this class with the given key-value pairs
|
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.
|
java.lang.String |
name()
Get the name of this goal.
|
boolean |
optimize(ClusterModel clusterModel,
java.util.Set<Goal> optimizedGoals,
OptimizationOptions optimizationOptions)
Optimize the given cluster model as needed for this goal.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canChangeReplicationFactor
public boolean optimize(ClusterModel clusterModel, java.util.Set<Goal> optimizedGoals, OptimizationOptions optimizationOptions) throws KafkaCruiseControlException
Goal
The method will be given a cluster model. The goal can try to optimize the cluster model by performing some admin operations (e.g. move replicas or leadership of partitions).
During the optimization, the implementation should make sure that all the previously optimized goals
are still satisfied after this method completes its execution. The implementation can use
Goal.actionAcceptance(BalancingAction, ClusterModel)
to check whether an admin operation
is allowed by a previously optimized goal.
The implementation of a soft goal should return a boolean indicating whether the goal has been met after the optimization or not.
The implementation of a hard goal should throw an OptimizationFailureException
when the goal
cannot be met. This will then fail the entire optimization attempt.
optimize
in interface Goal
clusterModel
- The cluster model reflecting the current state of the cluster. It is a result of the
optimization of the previously optimized goals.optimizedGoals
- Goals that have already been optimized. These goals cannot be violated.optimizationOptions
- Options to take into account during optimization -- e.g. excluded topics.KafkaCruiseControlException
public ActionAcceptance actionAcceptance(BalancingAction action, ClusterModel clusterModel)
actionAcceptance
in interface Goal
action
- Action to be checked for acceptance.clusterModel
- The state of the cluster.
ActionAcceptance.BROKER_REJECT
if the action is rejected due to violating rack awareness in the destination
broker after moving source replica to destination broker, ActionAcceptance.REPLICA_REJECT
otherwise.public ModelCompletenessRequirements clusterModelCompletenessRequirements()
Goal
clusterModelCompletenessRequirements
in interface Goal
public java.lang.String name()
public void finish()
Goal
public boolean isHardGoal()
Goal
isHardGoal
in interface Goal
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.clusterModelStatsComparator
in interface Goal
public void configure(java.util.Map<java.lang.String,?> configs)
CruiseControlConfigurable
configure
in interface CruiseControlConfigurable