AdminZkClient
is created when:
-
ConfigCommand
is requested to processCommandWithZk -
ReassignPartitionsCommand
is requested to verifyAssignment, generateAssignment, executeAssignment -
TopicCommand
is requested to createTopic, alterTopic, describeTopic -
Partition
is requested to getOrCreateReplica -
DynamicBrokerConfig
is requested to initialize -
AdminManager, DynamicConfigManager and KafkaApis are created
AdminZkClient
takes the following to be created:
AdminZkClient
initializes the internal properties.
fetchEntityConfig(
rootEntityType: String,
sanitizedEntityName: String): Properties
fetchEntityConfig
requests the KafkaZkClient to get the configuration from Zookeeper (under /config node) for the given rootEntityType
and sanitizedEntityName
.
Note
|
|
getAllTopicConfigs(): Map[String, Properties]
getAllTopicConfigs
…FIXME
Note
|
getAllTopicConfigs is used when…FIXME
|
fetchAllEntityConfigs(entityType: String): Map[String, Properties]
fetchAllEntityConfigs
…FIXME
Note
|
fetchAllEntityConfigs is used when…FIXME
|
fetchAllChildEntityConfigs(
rootEntityType: String,
childEntityType: String): Map[String, Properties]
fetchAllChildEntityConfigs
…FIXME
Note
|
fetchAllChildEntityConfigs is used when…FIXME
|
writeTopicPartitionAssignment(
topic: String,
replicaAssignment: Map[Int, Seq[Int]],
update: Boolean): Unit
writeTopicPartitionAssignment
…FIXME
Note
|
writeTopicPartitionAssignment is used exclusively when AdminZkClient is requested to createOrUpdateTopicPartitionAssignmentPathInZK.
|
createOrUpdateTopicPartitionAssignmentPathInZK(
topic: String,
partitionReplicaAssignment: Map[Int, Seq[Int]],
config: Properties = new Properties,
update: Boolean = false): Unit
createOrUpdateTopicPartitionAssignmentPathInZK
…FIXME
Note
|
|
createTopic(
topic: String,
partitions: Int,
replicationFactor: Int,
topicConfig: Properties = new Properties,
rackAwareMode: RackAwareMode = RackAwareMode.Enforced): Unit
createTopic
fetches the metadata of the brokers in the cluster (given the RackAwareMode
).
createTopic
requests AdminUtils
helper object to assignReplicasToBrokers (given the broker metadata, partitions and replicationFactor).
In the end, createTopic
createOrUpdateTopicPartitionAssignmentPathInZK.
Note
|
|
addPartitions(
topic: String,
existingAssignment: Map[Int, Seq[Int]],
allBrokers: Seq[BrokerMetadata],
numPartitions: Int = 1,
replicaAssignment: Option[Map[Int, Seq[Int]]] = None,
validateOnly: Boolean = false): Map[Int, Seq[Int]]
addPartitions
…FIXME
Note
|
addPartitions is used when…FIXME
|
Fetching Metadata of Brokers in Cluster (Broker ID and Rack Information) — getBrokerMetadatas
Method
getBrokerMetadatas(
rackAwareMode: RackAwareMode = RackAwareMode.Enforced,
brokerList: Option[Seq[Int]] = None): Seq[BrokerMetadata]
getBrokerMetadatas
requests the KafkaZkClient for the metadata of the brokers in the cluster.
Note
|
The broker metadata includes a broker ID, endpoints, and an optional rack information. |
getBrokerMetadatas
takes the input broker IDs (brokerList
) if defined and leaves only those that are available (i.e. among the brokers in the cluster) or falls back to all brokers in the cluster.
getBrokerMetadatas
branches off per RackAwareMode
as follows:
-
For
RackAwareMode.Disabled
orRackAwareMode.Safe
,getBrokerMetadatas
returnsBrokerMetadata
with broker IDs and no rack information -
For
RackAwareMode.Enforced
,getBrokerMetadatas
returnsBrokerMetadata
with broker IDs and rack information
In the end, getBrokerMetadatas
sorts the brokers by broker ID.
getBrokerMetadatas
throws an AdminOperationException
for RackAwareMode.Enforced
mode with some brokers without rack information:
Not all brokers have rack information. Add --disable-rack-aware in command line to make replica assignment without rack information.
Note
|
|