sendEvent(
event: ControllerEvent): Unit
AbstractControllerBrokerRequestBatch
AbstractControllerBrokerRequestBatch is the base of ControllerBrokerRequestBatches that sendRequestsToBrokers.
|
Note
|
ControllerBrokerRequestBatch is the default and only known implementation of the AbstractControllerBrokerRequestBatch Contract in Apache Kafka. |
| Method | Description |
|---|---|
|
Sends a ControllerEvent Used when |
|
Sends an controller request out to the given broker with optional callback to handle a response Used when |
Creating AbstractControllerBrokerRequestBatch Instance
AbstractControllerBrokerRequestBatch takes the following to be created:
AbstractControllerBrokerRequestBatch initializes the internal properties.
|
Note
|
AbstractControllerBrokerRequestBatch is a Scala abstract class and cannot be created directly. It is created indirectly for the concrete AbstractControllerBrokerRequestBatches.
|
Sending Controller Requests To Brokers — sendRequestsToBrokers Method
sendRequestsToBrokers(
controllerEpoch: Int): Unit
sendRequestsToBrokers sends LeaderAndIsr requests out to brokers.
sendRequestsToBrokers sends UpdateMetadata requests out to brokers.
sendRequestsToBrokers sends StopReplica requests out to brokers.
In case of any error (Throwable), sendRequestsToBrokers…FIXME
|
Note
|
|
Sending LeaderAndIsr Requests Out to All Brokers — sendLeaderAndIsrRequest Internal Method
sendLeaderAndIsrRequest(
controllerEpoch: Int,
stateChangeLog: StateChangeLogger): Unit
sendLeaderAndIsrRequest…FIXME
|
Note
|
sendLeaderAndIsrRequest is used exclusively when AbstractControllerBrokerRequestBatch is requested to sendRequestsToBrokers.
|
Sending UpdateMetadata Requests Out to All Brokers — sendUpdateMetadataRequests Internal Method
sendUpdateMetadataRequests(
controllerEpoch: Int,
stateChangeLog: StateChangeLogger): Unit
sendUpdateMetadataRequests prints out the following TRACE message to the logs for every pair in the updateMetadataRequestPartitionInfoMap internal registry:
Sending UpdateMetadata request [partitionState] to brokers [updateMetadataRequestBrokerSet] for partition [tp]
sendUpdateMetadataRequests prepares metadata for UpdateMetadataRequests.
For every broker (in the updateMetadataRequestBrokerSet internal registry) that is live or shutting down sendUpdateMetadataRequests requests the ControllerContext for the broker epoch, creates a new UpdateMetadataRequest (with the updateMetadataRequestPartitionInfoMap among others) and then sends the request out to the broker.
In the end, sendUpdateMetadataRequests removes all elements from (clears) the updateMetadataRequestBrokerSet and updateMetadataRequestPartitionInfoMap internal registries.
|
Note
|
sendUpdateMetadataRequests is used exclusively when AbstractControllerBrokerRequestBatch is requested to send controller requests to all brokers in a cluster.
|
Sending StopReplica Requests Out to All Brokers — sendStopReplicaRequests Internal Method
sendStopReplicaRequests(
controllerEpoch: Int): Unit
sendStopReplicaRequests…FIXME
|
Note
|
sendStopReplicaRequests is used exclusively when AbstractControllerBrokerRequestBatch is requested to sendRequestsToBrokers.
|
Preparing New Batch — newBatch Method
newBatch(): Unit
newBatch simply throws an IllegalStateException when any of the following internal registries are not empty: leaderAndIsrRequestMap, stopReplicaRequestMap and updateMetadataRequestBrokerSet.
Controller to broker state change requests batch is not empty while creating a new one. Some LeaderAndIsr state changes [leaderAndIsrRequestMap] might be lost
Controller to broker state change requests batch is not empty while creating a new one. Some StopReplica state changes [stopReplicaRequestMap] might be lost
Controller to broker state change requests batch is not empty while creating a new one. Some UpdateMetadata state changes to brokers [updateMetadataRequestBrokerSet] with partition info [updateMetadataRequestPartitionInfoMap] might be lost
|
Note
|
|
addLeaderAndIsrRequestForBrokers Method
addLeaderAndIsrRequestForBrokers(
brokerIds: Seq[Int],
topicPartition: TopicPartition,
leaderIsrAndControllerEpoch: LeaderIsrAndControllerEpoch,
replicas: Seq[Int],
isNew: Boolean): Unit
addLeaderAndIsrRequestForBrokers looks up the LeaderAndIsrPartitionStates of TopicPartitions on a broker in the leaderAndIsrRequestMap internal registry. addLeaderAndIsrRequestForBrokers uses IDs from the given brokerIds that are 0 or higher.
addLeaderAndIsrRequestForBrokers adds (or replaces) the given topicPartition in the result with a new LeaderAndIsrPartitionState based on the input arguments.
In the end, addLeaderAndIsrRequestForBrokers addUpdateMetadataRequestForBrokers to the live or shutting down brokers for the requested partition (topicPartition).
|
Note
|
|
addUpdateMetadataRequestForBrokers Method
addUpdateMetadataRequestForBrokers(
brokerIds: Seq[Int],
partitions: collection.Set[TopicPartition]): Unit
addUpdateMetadataRequestForBrokers…FIXME
|
Note
|
|
Internal Properties
| Name | Description |
|---|---|
|
|
|
|
|
Broker IDs to send UpdateMetadata requests out to
|