@ThreadSafe public class SelfHealingEvenClusterLoadStateManager extends Object implements EvenClusterLoadStateManager
EvenClusterLoadStateMachine.EvenClusterLoadState.BALANCING_FAILED
or
EvenClusterLoadStateMachine.EvenClusterLoadState.ABORTED
, we update current state to be success and move current failure
to previous.
So here is high level how previous and current states are captured:
1. Current rebalance run gets captured as part of currentStateMachine.
2. When a new rebalance starts, the currentStateMachine is saved to previousStateMachine and
a new currentStateMachine is created to capture state of current run.
3. If rebalance runs into an error, the error is captured in the currentStateMachine
4. If currentStateMachine is in error state (EvenClusterLoadStateMachine.EvenClusterLoadState.BALANCING_FAILED
or
EvenClusterLoadStateMachine.EvenClusterLoadState.ABORTED
states), and a goal violation check returns no violation,
then currentStateMachine is moved to previousStateMachine and a new currentStateMachine is created
with EvenClusterLoadStateMachine.EvenClusterLoadState.BALANCED
state.
Also note that although EvenClusterLoadStateMachine.EvenClusterLoadState.INITIALIZING
and EvenClusterLoadStateMachine.EvenClusterLoadState.DISABLED
are states that are defined as part of EvenClusterLoadStateMachine.EvenClusterLoadState
state enum, but the state machine is
never in that state. These states are checked and returned ot the api caller w/o creating a state machine.Constructor and Description |
---|
SelfHealingEvenClusterLoadStateManager(int brokerId,
org.apache.kafka.common.utils.Time time,
ApiStatePersistenceStore persistenceStore) |
Modifier and Type | Method and Description |
---|---|
EvenClusterLoadStateMachine.EvenClusterLoadState |
currentState() |
kafka.common.EvenClusterLoadStatusDescriptionInternal |
evenClusterLoadStatusDescription() |
void |
noGoalViolationsFound()
This method is invoked when Goal violation detector performs goal violation checks and doesn't
find any goal violation.
|
void |
registerEvent(EvenClusterLoadStateMachine.EvenClusterLoadEvent event)
Registers a new #
BalancerOperationEvent as part of the progress changing |
void |
registerEvent(EvenClusterLoadStateMachine.EvenClusterLoadEvent event,
Exception e)
Registers a new errorful #
BalancerOperationEvent as part of the progress changing |
void |
startRebalancing()
This method is invoked when we have found goal violations and have a list of proposals that
if executed are going to fix the goal violations.
|
public SelfHealingEvenClusterLoadStateManager(int brokerId, org.apache.kafka.common.utils.Time time, ApiStatePersistenceStore persistenceStore)
public void startRebalancing()
evenClusterLoadStatusDescription()
method then makes sure to return any error
that is not part of currently running rebalance as "even cluster load balance" api status.startRebalancing
in interface EvenClusterLoadStateManager
public void noGoalViolationsFound()
noGoalViolationsFound
in interface EvenClusterLoadStateManager
public void registerEvent(EvenClusterLoadStateMachine.EvenClusterLoadEvent event)
BalancerOperationCallback
BalancerOperationEvent
as part of the progress changingpublic void registerEvent(EvenClusterLoadStateMachine.EvenClusterLoadEvent event, Exception e)
BalancerOperationCallback
BalancerOperationEvent
as part of the progress changingpublic EvenClusterLoadStateMachine.EvenClusterLoadState currentState()
public kafka.common.EvenClusterLoadStatusDescriptionInternal evenClusterLoadStatusDescription()
evenClusterLoadStatusDescription
in interface EvenClusterLoadStateManager