ControllerState Contract

ControllerState is the contract of the states that KafkaController can be in.

Every ControllerEvent has an associated state. When a ControllerEvent is processed, it triggers a state transition to the requested state. These state transitions are used for ControllerEventManager and the owning KafkaController.

ControllerState has the rateAndTimeMetricName (except Idle state). ControllerContext uses them to build a registry of KafkaTimers for every ControllerState. The timer metric name pattern is kafka.controller:type=ControllerStats,name=.

ControllerStates RateAndTimeMs Timer Metrics in JConsole.png
Figure 1. ControllerStates and RateAndTimeMs Timer Metrics in JConsole
Table 1. ControllerState Contract
Method Description

value

value: Byte

Internal identifier

rateAndTimeMetricName

rateAndTimeMetricName: Option[String]

rateAndTimeMetricName depends on the hasRateAndTimeMetric flag:

  • [ControllerState_name]RateAndTimeMs when enabled

  • Undefined when disabled

hasRateAndTimeMetric

hasRateAndTimeMetric: Boolean

Controls whether the ControllerState has a RateAndTime metric (true) or not (false)

Default: true

Table 2. ControllerStates (and Triggering ControllerEvents)
ControllerState Description

AutoLeaderBalance

BrokerChange

rateAndTimeMetricName is LeaderElectionRateAndTimeMs

ControllerEvents: BrokerChange, BrokerModifications

ControlledShutdown

ControllerChange

ControllerEvents: RegisterBrokerAndReelect

ControllerShutdown

Idle

The initial state of ControllerEventManager (and indirectly KafkaController)

Idle has no rateAndTime metric.

IsrChange

ControllerEvents: IsrChangeNotification

LeaderAndIsrResponseReceived

LogDirChange

ControllerEvents: LogDirEventNotification

ManualLeaderBalance

ControllerEvents: PreferredReplicaLeaderElection

PartitionReassignment

ControllerEvents: PartitionReassignment, PartitionReassignmentIsrChange

TopicChange

ControllerEvents: TopicChange, PartitionModifications

TopicDeletion

ControllerEvents: TopicDeletion

TopicUncleanLeaderElectionEnable

UncleanLeaderElectionEnable

Note
ControllerState is a Scala sealed abstract class and so all the possible controller states are in a single compilation unit (i.e. a file).

results matching ""

    No results matching ""