...
This KIP will include the broker generation (broker_epoch) in LeaderAndIsrRequest, UpdateMetadataRequest, StopReplicaRequest, ControlledShutdownRequest and bump up their protocol versions. Since we will evolve the schema of control requests in this KIP, I would also normalize the schema of these requests by avoiding data redundancy for the topic strings to reduce the memory footprint in the controller side and reduce the amount of data we send across the network. Here are the new version of these requests
Changes in Control Requests:
Code Block | ||
---|---|---|
| ||
LeaderAndIsr Request => controller_id controller_epoch broker_epoch [topic_states] [live_leaders] controller_id => INT32 controller_epoch => INT32 broker_epoch => INT64 <-- NEW topic_states => topic [partition_states] <-- NEW topic => STRING partitions_states => partition controller_epoch leader leader_epoch [isr] zk_version [replicas] is_new partition => INT32 controller_epoch => INT32 leader => INT32 leader_epoch => INT32 isr => INT32 zk_version => INT32 replicas => INT32 is_new => BOOLEAN live_leaders => id host port id => INT32 host => STRING port => INT32 |
...
Note: Normalizing the schema is a good-to-have optimization because the memory footprint for the control requests hinders the controller from scaling up if we have many topics with large partition counts. We already did the same thing in other types of request (e.g. Produce, Fetch, ...).
New Error Code:
New error code STALE_BROKER_EPOCH (77) and a new type of exception StaleBrokerEpochException will be added. When a broker sees a LeaderAndIsrRequest/UpdateMetadataRequest/StopReplicaRequest with outdated broker epoch, it will respond back with STALE_BROKER_EPOCH error. When the controller sees a ControlledShutdownRequest with outdated broker epoch, it will respond back with STALE_BROKER_EPOCH error.
Proposed Changes
Broker Registration in Zookeeper
...