ControllerContext

ControllerContext is the context of a KafkaController (and is created exclusively when KafkaController is created).

Table 1. ControllerContext’s Registries
Name Description

allTopics

controllerChannelManager

epoch

epochZkVersion

liveBrokers

liveBrokerIds

liveBrokersUnderlying

liveBrokerIdsUnderlying

liveOrShuttingDownBrokerIds

liveOrShuttingDownBrokers

partitionsBeingReassigned

partitionLeadershipInfo

partitionLeadershipInfo: mutable.Map[TopicPartition, LeaderIsrAndControllerEpoch]

partitionReplicaAssignmentUnderlying

partitionReplicaAssignmentUnderlying: mutable.Map[String, mutable.Map[Int, Seq[Int]]]

partitionReplicaAssignmentUnderlying is updated exclusively when ControllerContext is requested to updatePartitionReplicaAssignment

replicasOnOfflineDirs

shuttingDownBrokerIds

stats

ControllerStats with UncleanLeaderElectionsPerSec meter metric and KafkaTimers for every ControllerState (except Idle state)

stats is used exclusively to create the ControllerEventManager (of KafkaController) that is then used to collect the times (metrics) of processing every ControllerEvent (except ShutdownEventThread)

The timer metric name pattern is kafka.controller:type=ControllerStats,name=.

ControllerContext takes no input arguments when created.

allPartitions Method

allPartitions: Set[TopicPartition]

allPartitions converts the partitionReplicaAssignmentUnderlying into TopicPartitions, i.e. allPartitions takes the partitions for the topics and simply creates new TopicPartitions.

Note

allPartitions is used when:

updatePartitionReplicaAssignment Method

updatePartitionReplicaAssignment(topicPartition: TopicPartition, newReplicas: Seq[Int]): Unit

updatePartitionReplicaAssignment simply updates the partitionReplicaAssignmentUnderlying registry with newReplicas for the topic and the partition (of a given TopicPartition).

Note

updatePartitionReplicaAssignment is used when:

partitionsOnBroker Method

partitionsOnBroker(brokerId: Int): Set[TopicPartition]

partitionsOnBroker…​FIXME

Note
partitionsOnBroker is used when…​FIXME

replicasOnBrokers Method

replicasOnBrokers(brokerIds: Set[Int]): Set[PartitionAndReplica]

replicasOnBrokers…​FIXME

Note
replicasOnBrokers is used when…​FIXME

replicasForTopic Method

replicasForTopic(topic: String): Set[PartitionAndReplica]

replicasForTopic…​FIXME

Note
replicasForTopic is used when…​FIXME

partitionsForTopic Method

partitionsForTopic(topic: String): collection.Set[TopicPartition]

partitionsForTopic…​FIXME

Note
partitionsForTopic is used when…​FIXME

removeTopic Method

removeTopic(topic: String): Unit

removeTopic…​FIXME

Note
removeTopic is used when…​FIXME

isReplicaOnline Method

isReplicaOnline(
  brokerId: Int,
  topicPartition: TopicPartition,
  includeShuttingDownBrokers: Boolean = false): Boolean

isReplicaOnline…​FIXME

Note
isReplicaOnline is used when…​FIXME

results matching ""

    No results matching ""