MetadataCache

MetadataCache is…​FIXME

MetadataCache is created exclusively for KafkaServer (when started).

MetadataCache takes a single broker ID when created.

MetadataCache maintains the metadataSnapshot and is used to…​FIXME

MetadataCache tracks the controllerId…​FIXME

Table 1. MetadataCache’s Internal Properties (e.g. Registries, Counters and Flags)
Name Description

metadataSnapshot

MetadataSnapshot

metadataSnapshot is updated when MetadataCache is requested to updateMetadata

partitionMetadataLock

Java’s ReentrantReadWriteLock

stateChangeLogger

MetadataCache uses [MetadataCache brokerId=[brokerId]] as the logging prefix (aka logIdent).

Tip

Enable DEBUG or ERROR logging level for kafka.server.MetadataCache logger to see what happens inside.

Add the following line to config/log4j.properties:

log4j.logger.kafka.server.MetadataCache=DEBUG

Refer to Logging.

getAllTopics Method

getAllTopics(): Set[String]

getAllTopics…​FIXME

Note
getAllTopics is used when…​FIXME

getTopicMetadata Method

getTopicMetadata(
  topics: Set[String],
  listenerName: ListenerName,
  errorUnavailableEndpoints: Boolean = false,
  errorUnavailableListeners: Boolean = false): Seq[MetadataResponse.TopicMetadata]

getTopicMetadata…​FIXME

Note
getTopicMetadata is used when…​FIXME

getAliveBrokers Method

getAliveBrokers: Seq[Broker]

getAliveBrokers…​FIXME

Note
getAliveBrokers is used when…​FIXME

Updating Metadata (and Returning Deleted Partitions) — updateMetadata Method

updateMetadata(
  correlationId: Int,
  updateMetadataRequest: UpdateMetadataRequest): Seq[TopicPartition]

updateMetadata…​FIXME

Note
updateMetadata is used exclusively when ReplicaManager is requested to maybeUpdateMetadataCache.

getClusterMetadata Method

getClusterMetadata(clusterId: String, listenerName: ListenerName): Cluster

getClusterMetadata…​FIXME

Note
getClusterMetadata is used exclusively when KafkaApis is requested to handle an UpdateMetadata request.

getPartitionReplicaEndpoints Method

getPartitionReplicaEndpoints(
  tp: TopicPartition,
  listenerName: ListenerName): Map[Int, Node]

getPartitionReplicaEndpoints…​FIXME

Note
getPartitionReplicaEndpoints is used when ReplicaManager is requested to findPreferredReadReplica.

results matching ""

    No results matching ""