public class GoalViolationDetector extends Object implements Runnable, BrokerLivenessListener
Constructor and Description |
---|
GoalViolationDetector(KafkaCruiseControlConfig kccConfig,
LoadMonitor loadMonitor,
Queue<Anomaly> anomalies,
org.apache.kafka.common.utils.Time time,
KafkaCruiseControl kafkaCruiseControl,
UpdatableSbcGoalsConfig updatableSbcGoalsConfig,
KafkaCruiseControl.CcStartupMode startupMode,
DataBalancerMetricsRegistry metricsRegistry) |
Modifier and Type | Method and Description |
---|---|
double |
balancednessScore() |
Optional<GoalViolations> |
detectViolations()
Goes through each goal and tries to optimize the cluster model in order to understand if there are any goal violations present.
|
void |
notifyDeadBrokers(Set<Integer> deadBrokers)
Be told of brokers that have left the cluster.
|
void |
notifyNewAddingBrokers(Set<Integer> newAddingBrokers)
A notification indicating that the given brokers with zero replicas just became online in the cluster.
|
void |
notifyNewlyOnlineBrokers(Set<Integer> newlyOnlineBrokers)
A notification indicating that the given
newBrokers brokers became online in the cluster. |
void |
run() |
public GoalViolationDetector(KafkaCruiseControlConfig kccConfig, LoadMonitor loadMonitor, Queue<Anomaly> anomalies, org.apache.kafka.common.utils.Time time, KafkaCruiseControl kafkaCruiseControl, UpdatableSbcGoalsConfig updatableSbcGoalsConfig, KafkaCruiseControl.CcStartupMode startupMode, DataBalancerMetricsRegistry metricsRegistry)
public double balancednessScore()
SbcGoalsConfig.triggeringGoals()
.public void notifyNewAddingBrokers(Set<Integer> newAddingBrokers)
notifyNewAddingBrokers
in interface BrokerLivenessListener
public void notifyNewlyOnlineBrokers(Set<Integer> newlyOnlineBrokers)
newBrokers
brokers became online in the cluster.
The detector handles this by pausing detection for deferGoalDetectionOnNewMembersDelayMs
milliseconds,
as protection to avoid balancing while restart/cluster-upgrade roll operations are happening.notifyNewlyOnlineBrokers
in interface BrokerLivenessListener
newlyOnlineBrokers
- the set of brokers that came online in the cluster and are not being addedpublic void notifyDeadBrokers(Set<Integer> deadBrokers)
notifyDeadBrokers
in interface BrokerLivenessListener
deadBrokers
- public Optional<GoalViolations> detectViolations() throws Exception
{@link
- org.apache.kafka.common.errors.RebalanceInProgressDuringPlanComputationException} if a reassignment is detected while computing the cluster model
public for testing purposes.Exception