ReplicaManager

ReplicaManager is created and immediately started when KafkaServer is requested to start up.

ReplicaManager.png
Figure 1. ReplicaManager and KafkaServer

When started, ReplicaManager schedules isr-expiration and isr-change-propagation recurring tasks (every half of replica.lag.time.max.ms property and 2500 ms, respectively).

ReplicaManager is a KafkaMetricsGroup.

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

replicaFetcherManager

ReplicaFetcherManager

allPartitions

Pool of TopicPartition and Partitions

isrChangeSet

Collection of TopicPartition that…​FIXME

lastIsrChangeMs

Time when isrChangeSet has a new TopicPartition added.

logDirFailureHandler

LogDirFailureHandler

OfflinePartition

createReplicaFetcherManager Internal Method

createReplicaFetcherManager(
  metrics: Metrics
  time: Time
  threadNamePrefix: Option[String]
  quotaManager: ReplicationQuotaManager): ReplicaFetcherManager

createReplicaFetcherManager…​FIXME

Note
createReplicaFetcherManager is used when…​FIXME

shutdown Method

shutdown(checkpointHW: Boolean = true): Unit

shutdown…​FIXME

Note
shutdown is used when…​FIXME

alterReplicaLogDirs Method

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

alterReplicaLogDirs…​FIXME

Note
alterReplicaLogDirs is used exclusively when KafkaApis handles AlterReplicaLogDirs request.

becomeLeaderOrFollower Method

becomeLeaderOrFollower(
  correlationId: Int,
  leaderAndIsrRequest: LeaderAndIsrRequest,
  onLeadershipChange: (Iterable[Partition], Iterable[Partition]) => Unit): LeaderAndIsrResponse

becomeLeaderOrFollower…​FIXME

Note
becomeLeaderOrFollower is used exclusively when KafkaApis is requested to handle a LeaderAndIsr request.

makeFollowers Internal Method

makeFollowers(
  controllerId: Int,
  epoch: Int,
  partitionState: Map[Partition, LeaderAndIsrRequest.PartitionState],
  correlationId: Int,
  responseMap: mutable.Map[TopicPartition, Errors]) : Set[Partition]

makeFollowers…​FIXME

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

recordIsrChange Method

recordIsrChange(topicPartition: TopicPartition): Unit

recordIsrChange adds the input topicPartition to isrChangeSet internal registry and sets lastIsrChangeMs to the current time.

Note
recordIsrChange is used exclusively when Partition does updateIsr

updateFollowerLogReadResults Internal Method

updateFollowerLogReadResults(
  replicaId: Int,
  readResults: Seq[(TopicPartition, LogReadResult)]): Seq[(TopicPartition, LogReadResult)]

updateFollowerLogReadResults…​FIXME

Note
updateFollowerLogReadResults is used exclusively when ReplicaManager fetches messages from the leader replica.

fetchMessages Method

fetchMessages(
  timeout: Long,
  replicaId: Int,
  fetchMinBytes: Int,
  fetchMaxBytes: Int,
  hardMaxBytesLimit: Boolean,
  fetchInfos: Seq[(TopicPartition, FetchRequest.PartitionData)],
  quota: ReplicaQuota = UnboundedQuota,
  responseCallback: Seq[(TopicPartition, FetchPartitionData)] => Unit,
  isolationLevel: IsolationLevel): Unit

fetchMessages…​FIXME

Note
fetchMessages is used exclusively when KafkaApis handles a Fetch request.

getLeaderPartitions Internal Method

getLeaderPartitions: List[Partition]

getLeaderPartitions gives the partitions from allPartitions that are not offline and their leaderReplicaIfLocal property is defined.

Note
getLeaderPartitions is used when…​FIXME

maybePropagateIsrChanges Method

maybePropagateIsrChanges(): Unit

maybePropagateIsrChanges…​FIXME

Note
maybePropagateIsrChanges is used exclusively when isr-change-propagation task is executed (every 2500 milliseconds).

Creating ReplicaManager Instance

ReplicaManager takes the following when created:

ReplicaManager initializes the internal registries and counters.

startup(): Unit

startup then creates a LogDirFailureHandler and requests it to start.

Note
startup uses Scheduler that was specified when ReplicaManager was created.
Note
startup is used exclusively when KafkaServer starts up.

maybeShrinkIsr Internal Method

maybeShrinkIsr(): Unit

maybeShrinkIsr prints out the following TRACE message to the logs:

TRACE Evaluating ISR list of partitions to see which replicas can be removed from the ISR

maybeShrinkIsr requests the partitions (from allPartitions pool that are not offline partitions) to maybeShrinkIsr (with replicaLagTimeMaxMs property).

Note
maybeShrinkIsr is used exclusively to schedule isr-expiration recurring task when ReplicaManager starts up.

makeLeaders Internal Method

makeLeaders(
  controllerId: Int,
  epoch: Int,
  partitionState: Map[Partition, LeaderAndIsrRequest.PartitionState],
  correlationId: Int,
  responseMap: mutable.Map[TopicPartition, Errors]): Set[Partition]

makeLeaders…​FIXME

Note
makeLeaders is used exclusively when ReplicaManager is requested to becomeLeaderOrFollower

describeLogDirs Method

describeLogDirs(partitions: Set[TopicPartition]): Map[String, LogDirInfo]

describeLogDirs…​FIXME

Note
describeLogDirs is used exclusively when KafkaApis is requested to handle a DescribeLogDirs request.

getLog Method

getLog(topicPartition: TopicPartition): Option[Log]

getLog…​FIXME

Note
getLog is used when…​FIXME

startHighWaterMarksCheckPointThread Method

startHighWaterMarksCheckPointThread(): Unit

startHighWaterMarksCheckPointThread…​FIXME

Note
startHighWaterMarksCheckPointThread is used when…​FIXME

checkpointHighWatermarks Method

checkpointHighWatermarks(): Unit

checkpointHighWatermarks…​FIXME

Note
checkpointHighWatermarks is used when…​FIXME

shutdownIdleReplicaAlterLogDirsThread Method

shutdownIdleReplicaAlterLogDirsThread(): Unit

shutdownIdleReplicaAlterLogDirsThread…​FIXME

Note
shutdownIdleReplicaAlterLogDirsThread is used when…​FIXME

handleLogDirFailure Method

handleLogDirFailure(dir: String, sendZkNotification: Boolean = true): Unit

handleLogDirFailure…​FIXME

Note
handleLogDirFailure is used exclusively when LogDirFailureHandler is requested to doWork.

results matching ""

    No results matching ""