Skip to content

ControllerState

== [[ControllerState]] ControllerState Contract

ControllerState is the <> of the <> that <> can be in.

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

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

.ControllerStates and RateAndTimeMs Timer Metrics in JConsole image::images/ControllerStates-RateAndTimeMs-Timer-Metrics-in-JConsole.png[align="center"]

[[contract]] .ControllerState Contract [cols="1m,2",options="header",width="100%"] |=== | Method | Description

| value a| [[value]]

[source, scala]

value: Byte

Internal identifier

| rateAndTimeMetricName a| [[rateAndTimeMetricName]]

[source, scala]

rateAndTimeMetricName: Option[String]

rateAndTimeMetricName depends on the <> flag:

  • [ControllerState_name]RateAndTimeMs when enabled

  • Undefined when disabled

| hasRateAndTimeMetric a| [[hasRateAndTimeMetric]]

[source, scala]

hasRateAndTimeMetric: Boolean

Controls whether the ControllerState has a <> (true) or not (false)

Default: true |===

[[implementations]] .ControllerStates (and Triggering ControllerEvents) [cols="1m,3",options="header",width="100%"] |=== | ControllerState | Description

| AutoLeaderBalance | [[AutoLeaderBalance]]

| BrokerChange | [[BrokerChange]] <> is LeaderElectionRateAndTimeMs

ControllerEvents: BrokerChange, BrokerModifications

| ControlledShutdown | [[ControlledShutdown]]

| ControllerChange | [[ControllerChange]] ControllerEvents: RegisterBrokerAndReelect

| ControllerShutdown | [[ControllerShutdown]]

| Idle | [[Idle]] The initial state of <> (and indirectly <>)

Idle <>.

| IsrChange | [[IsrChange]] ControllerEvents: <>

| LeaderAndIsrResponseReceived | [[LeaderAndIsrResponseReceived]]

| LogDirChange | [[LogDirChange]] ControllerEvents: LogDirEventNotification

| ManualLeaderBalance | [[ManualLeaderBalance]] ControllerEvents: <>

| PartitionReassignment | [[PartitionReassignment]] ControllerEvents: PartitionReassignment, PartitionReassignmentIsrChange

| TopicChange | [[TopicChange]] ControllerEvents: TopicChange, PartitionModifications

| TopicDeletion | [[TopicDeletion]] ControllerEvents: TopicDeletion

| TopicUncleanLeaderElectionEnable | [[TopicUncleanLeaderElectionEnable]]

| UncleanLeaderElectionEnable | [[UncleanLeaderElectionEnable]]

|===

NOTE: ControllerState is a Scala sealed abstract class and so all the possible <> are in a single compilation unit (i.e. a file).