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.
| Version | Kafka | Changes |
|---|---|---|
| ElectLeadersRequest | ||
| v0 | 2.4 | + TopicPartitions []TopicPartitions+ Topic string+ Partitions []int32+ TimeoutMs int32 |
| v1 | 2.4 | + ElectionType int8implements multiple leader election types, as described by KIP-460. |
| v2 | 2.4 | ~ Flexible encoding enabled FLEXIBLE is the first flexible version. |
| ElectLeadersResponse | ||
| v0 | 2.4 | + ThrottleTimeMs int32+ ReplicaElectionResults []ReplicaElectionResult+ Topic string+ PartitionResult []PartitionResult+ PartitionId int32+ ErrorCode int16+ ErrorMessage string |
| v1 | 2.4 | + ErrorCode int16adds a top-level error code. |
| v2 | 2.4 | ~ Flexible encoding enabled FLEXIBLE is the first flexible version. |