public class GoalOptimizer
extends java.lang.Object
Constructor and Description |
---|
GoalOptimizer(KafkaCruiseControlConfig config,
LoadMonitor loadMonitor,
DataBalancerMetricsRegistry metricRegistry)
Constructor for Goal Optimizer takes the goals as input.
|
Modifier and Type | Method and Description |
---|---|
ModelCompletenessRequirements |
defaultModelCompletenessRequirements() |
OptimizerResult |
optimizations(ClusterModel clusterModel,
java.util.List<Goal> goalsByPriority,
java.util.Set<java.lang.Integer> excludedBrokersForLeadership,
java.util.Set<java.lang.Integer> excludedBrokersForReplicaMove,
boolean isTriggeredByGoalViolation,
java.util.Map<org.apache.kafka.common.TopicPartition,java.util.List<ReplicaPlacementInfo>> initReplicaDistributionForProposalGeneration)
Depending the existence of dead/broken/decommissioned brokers in the given cluster:
(1) Re-balance: Generates proposals to update the state of the cluster to achieve a final balanced state.
|
AnalyzerState |
state(MetadataClient.ClusterAndGeneration clusterAndGeneration)
Get the analyzer state from the goal optimizer.
|
public GoalOptimizer(KafkaCruiseControlConfig config, LoadMonitor loadMonitor, DataBalancerMetricsRegistry metricRegistry)
config
- The Kafka Cruise Control Configuration.public ModelCompletenessRequirements defaultModelCompletenessRequirements()
public AnalyzerState state(MetadataClient.ClusterAndGeneration clusterAndGeneration)
public OptimizerResult optimizations(ClusterModel clusterModel, java.util.List<Goal> goalsByPriority, java.util.Set<java.lang.Integer> excludedBrokersForLeadership, java.util.Set<java.lang.Integer> excludedBrokersForReplicaMove, boolean isTriggeredByGoalViolation, java.util.Map<org.apache.kafka.common.TopicPartition,java.util.List<ReplicaPlacementInfo>> initReplicaDistributionForProposalGeneration) throws KafkaCruiseControlException
clusterModel
- The state of the cluster over which the balancing proposal will be applied. Function execution
updates the cluster state with balancing proposals.goalsByPriority
- the goals ordered by priority.excludedBrokersForLeadership
- Brokers excluded from receiving leadership upon proposal generation.excludedBrokersForReplicaMove
- Brokers excluded from receiving replicas upon proposal generation.isTriggeredByGoalViolation
- True if optimization of goals is triggered by goal violation, false otherwise.initReplicaDistributionForProposalGeneration
- The initial replica distribution of the cluster. This is only needed
if the passed in clusterModel is not the original cluster model so
that initial replica distribution can not be deducted from that
cluster model, otherwise it is null. One case explicitly specifying
initial replica distribution needed is to increase/decrease specific
topic partition's replication factor, in this case some replicas
are tentatively deleted/added in cluster model before passing it
in to generate proposals.KafkaCruiseControlException