Skip to content

Latest commit

 

History

History
215 lines (141 loc) · 8.57 KB

kafka-zk-AdminZkClient.adoc

File metadata and controls

215 lines (141 loc) · 8.57 KB

AdminZkClient

AdminZkClient is created when:

Creating AdminZkClient Instance

AdminZkClient takes the following to be created:

AdminZkClient initializes the internal properties.

Reading Entity Configuration From Zookeeper (Under /config Node) — fetchEntityConfig Method

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

fetchEntityConfig is used when:

getAllTopicConfigs Method

getAllTopicConfigs(): Map[String, Properties]

getAllTopicConfigs…​FIXME

Note
getAllTopicConfigs is used when…​FIXME

fetchAllEntityConfigs Method

fetchAllEntityConfigs(entityType: String): Map[String, Properties]

fetchAllEntityConfigs…​FIXME

Note
fetchAllEntityConfigs is used when…​FIXME

fetchAllChildEntityConfigs Method

fetchAllChildEntityConfigs(
  rootEntityType: String,
  childEntityType: String): Map[String, Properties]

fetchAllChildEntityConfigs…​FIXME

Note
fetchAllChildEntityConfigs is used when…​FIXME

writeTopicPartitionAssignment Internal Method

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 Internal Method

createOrUpdateTopicPartitionAssignmentPathInZK(
  topic: String,
  partitionReplicaAssignment: Map[Int, Seq[Int]],
  config: Properties = new Properties,
  update: Boolean = false): Unit

createOrUpdateTopicPartitionAssignmentPathInZK…​FIXME

Note

createOrUpdateTopicPartitionAssignmentPathInZK is used when:

Creating Topic — createTopic Method

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).

Note

createTopic is used when:

addPartitions Method

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 or RackAwareMode.Safe, getBrokerMetadatas returns BrokerMetadata with broker IDs and no rack information

  • For RackAwareMode.Enforced, getBrokerMetadatas returns BrokerMetadata 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

getBrokerMetadatas is used when: