ControllerContext¶
Review Me¶
ControllerContext is the context of an active <KafkaController is <
[[creating-instance]] ControllerContext takes no input arguments to be created.
=== [[allPartitions]] allPartitions Method
[source, scala]¶
allPartitions: Set[TopicPartition]¶
allPartitions converts the <TopicPartitions, i.e. allPartitions takes the partitions for the topics and simply creates new TopicPartitions.
[NOTE]¶
allPartitions is used when:
-
KafkaControlleris requested to <>, < >, and < > -
PartitionStateMachineis requested to <>
* ReplicaStateMachine is requested to <>¶
=== [[updatePartitionReplicaAssignment]] updatePartitionReplicaAssignment Method
[source, scala]¶
updatePartitionReplicaAssignment(topicPartition: TopicPartition, newReplicas: Seq[Int]): Unit¶
updatePartitionReplicaAssignment simply updates the <newReplicas for the topic and the partition (of a given TopicPartition).
[NOTE]¶
updatePartitionReplicaAssignment is used when:
KafkaControlleris requested to <>, < >, < >, and at < > and < > controller events
* ReplicaStateMachine is requested to <>¶
=== [[partitionReplicaAssignment]] partitionReplicaAssignment Method
[source, scala]¶
partitionReplicaAssignment( topicPartition: TopicPartition): Seq[Int]
partitionReplicaAssignment finds the brokers with the replicas of the given partition (aka partition replica assignment).
Internally, partitionReplicaAssignment finds broker IDs of the replicas of the given partition (TopicPartition) in the <
partitionReplicaAssignment returns an empty collection when no topic or partition are found.
NOTE: partitionReplicaAssignment is used when...FIXME
=== [[putReplicaStateIfNotExists]] putReplicaStateIfNotExists Method
[source, scala]¶
putReplicaStateIfNotExists( replica: PartitionAndReplica, state: ReplicaState): Unit
putReplicaStateIfNotExists simply adds the replica to the <
NOTE: putReplicaStateIfNotExists is used exclusively when ZkReplicaStateMachine is requested to <
=== [[checkValidReplicaStateChange]] checkValidReplicaStateChange Method
[source, scala]¶
checkValidReplicaStateChange( replicas: Seq[PartitionAndReplica], targetState: ReplicaState ): (Seq[PartitionAndReplica], Seq[PartitionAndReplica])
For every replica (in the given replicas), checkValidReplicaStateChange <ReplicaState).
NOTE: checkValidReplicaStateChange is used exclusively when ZkReplicaStateMachine is requested to <
=== [[checkValidPartitionStateChange]] checkValidPartitionStateChange Method
[source, scala]¶
checkValidPartitionStateChange( partitions: Seq[TopicPartition], targetState: PartitionState ): (Seq[TopicPartition], Seq[TopicPartition])
For every replica (in the given replicas), checkValidPartitionStateChange <PartitionState).
NOTE: checkValidPartitionStateChange is used exclusively when ZkReplicaStateMachine is requested to <
=== [[partitionsInStates]] Finding Partitions by Given States -- partitionsInStates Method
[source, scala]¶
partitionsInStates( states: Set[PartitionState]): Set[TopicPartition] partitionsInStates( topic: String, states: Set[PartitionState]): Set[TopicPartition]
partitionsInStates uses the <TopicPartitions (of the topic if defined) in the given PartitionStates.
NOTE: partitionsInStates is used when PartitionStateMachine is requested to link:kafka-controller-PartitionStateMachine.md#triggerOnlinePartitionStateChange[triggerOnlinePartitionStateChange].
ControllerStats¶
ControllerStats with UncleanLeaderElectionsPerSec meter metric and KafkaTimers for every ControllerState (except Idle state)
stats is used exclusively to create the <
- Every
ControllerStatehas the <> metric defined (except < > state)
The timer metric name pattern is kafka.controller:type=ControllerStats,name=.