Partition

A Kafka topic is spread across a Kafka cluster as a virtual group of one or more partitions.

A single partition of a topic (topic partition) can be replicated across a Kafka cluster to one or more Kafka brokers.

A topic partition has one partition leader node and zero or more replicas.

Kafka producers publish messages to topic leaders as do Kafka consumers consume them from.

In-Sync Replicas (ISR) are brokers that…​FIXME

Offline Replicas are…​FIXME

Partition is…​FIXME

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

inSyncReplicas

In-sync Replicas

leaderReplicaIdOpt

Optional leader replica ID

localBrokerId

One of the following:

logManager

LogManager (of the ReplicaManager) if not offline or null

zkClient

KafkaZkClient (of the ReplicaManager) if not offline or null

topicPartition

TopicPartition (with the topic and partitionId)

maybeExpandIsr Method

maybeExpandIsr(replicaId: Int, logReadResult: LogReadResult): Boolean

maybeExpandIsr…​FIXME

Note
maybeExpandIsr is used exclusively when Partition is requested to updateReplicaLogReadResult.

maybeShrinkIsr Method

maybeShrinkIsr(replicaMaxLagTimeMs: Long): Unit

maybeShrinkIsr…​FIXME

Note
maybeShrinkIsr is used exclusively when ReplicaManager maybeShrinkIsr.

updateReplicaLogReadResult Method

updateReplicaLogReadResult(replica: Replica, logReadResult: LogReadResult): Boolean

updateReplicaLogReadResult…​FIXME

Note
updateReplicaLogReadResult is used exclusively when ReplicaManager updateFollowerLogReadResults.

updateIsr Internal Method

updateIsr(newIsr: Set[Replica]): Unit

updateIsr…​FIXME

Note
updateIsr is used when Partition is requested to expand or shrink the ISR.

makeFollower Method

makeFollower(
  controllerId: Int,
  partitionStateInfo: LeaderAndIsrRequest.PartitionState,
  correlationId: Int): Boolean

makeFollower…​FIXME

Note
makeFollower is used exclusively when ReplicaManager is requested to makeFollowers.

leaderReplicaIfLocal Method

leaderReplicaIfLocal: Option[Replica]

leaderReplicaIfLocal gives…​FIXME

Note
leaderReplicaIfLocal is used…​FIXME

maybeShrinkIsr Method

Caution
FIXME

Creating Partition Instance

Partition takes the following when created:

  • Topic name

  • Partition ID

  • Time

  • ReplicaManager

  • isOffline flag (default: false)

Partition initializes the internal registries and counters.

isUnderReplicated Predicate

isUnderReplicated: Boolean

isUnderReplicated is true only if the partition isLeaderReplicaLocal and the number of in-sync replicas is below the assignedReplicas.

Note
isUnderReplicated is used when…​FIXME

isUnderMinIsr Predicate

isUnderMinIsr: Boolean

isUnderMinIsr is true only if the partition isLeaderReplicaLocal and the number of in-sync replicas is below the min.insync.replicas configuration property (as configured for the Log of the leader replica).

Note
isUnderMinIsr is used when…​FIXME

checkEnoughReplicasReachOffset Method

checkEnoughReplicasReachOffset(requiredOffset: Long): (Boolean, Errors)

checkEnoughReplicasReachOffset…​FIXME

Note
checkEnoughReplicasReachOffset is used when…​FIXME

makeLeader Method

makeLeader(
  controllerId: Int,
  partitionStateInfo: LeaderAndIsrRequest.PartitionState,
  correlationId: Int): Boolean

makeLeader…​FIXME

Note
makeLeader is used exclusively when ReplicaManager is requested to makeLeaders.

getOrCreateReplica Method

getOrCreateReplica(
  replicaId: Int = localBrokerId,
  isNew: Boolean = false): Replica

getOrCreateReplica…​FIXME

Note

getOrCreateReplica is used when:

maybeCreateFutureReplica Method

maybeCreateFutureReplica(logDir: String): Boolean

maybeCreateFutureReplica…​FIXME

Note
maybeCreateFutureReplica is used exclusively when Partition is requested to alterReplicaLogDirs.

alterReplicaLogDirs Method

alterReplicaLogDirs(partitionDirs: Map[TopicPartition, String]): Map[TopicPartition, Errors]

alterReplicaLogDirs…​FIXME

Note
alterReplicaLogDirs is used exclusively when KafkaApis is requested to handle an AlterReplicaLogDirs request.

results matching ""

    No results matching ""