What is ElectLeaders?
Forces preferred leader elections or triggers unclean elections via kafka-leader-election.sh. Preferred election safely moves leadership back to the first replica; unclean election (type=1) risks data loss by electing an out-of-sync replica when no in-sync replica is available.
Wire Diagram
Response Header
message_size
int32 · 4B
correlation_id
int32 · 4B
ElectLeadersResponse v0
ThrottleTimeMs
int32 · 4B
Topic
string
PartitionId
int32 · 4B
ErrorCode
int16 · 2B
ErrorMessage?
string
Schema & Example
Schema { "ThrottleTimeMs": int32, "ReplicaElectionResults": [{ "Topic": string, "PartitionResult": [{ "PartitionId": int32, "ErrorCode": int16, "ErrorMessage": string? }] }] }
Example { "ThrottleTimeMs": 0, "ReplicaElectionResults": [{ "Topic": "orders", "PartitionResult": [{ "PartitionId": 1, "ErrorCode": 0, "ErrorMessage": null }] }] }