conduktor.io ↗

Kafka ElectLeaders Response Wire Format v2 — Binary Protocol Layout

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.

Related Errors

ELECTION_NOT_NEEDED · ELIGIBLE_LEADERS_NOT_AVAILABLE · NOT_CONTROLLER

Wire Diagram

Response Header · flexible
message_size int32 · 4B
correlation_id int32 · 4B
tagged var
ElectLeadersResponse v2
ThrottleTimeMs int32 · 4B
ErrorCode int16 · 2B
ReplicaElectionResults array
tagged var
Topic string (compact)
PartitionResult array
tagged var
PartitionId int32 · 4B
ErrorCode int16 · 2B
ErrorMessage? string (compact)
tagged var

Schema & Example

Schema
{
  "ThrottleTimeMs": int32,
  "ErrorCode": int16,
  "ReplicaElectionResults": [{
      "Topic": string,
      "PartitionResult": [{
          "PartitionId": int32,
          "ErrorCode": int16,
          "ErrorMessage": string?
      }]
  }]
}
Example
{
  "ThrottleTimeMs": 0,
  "ErrorCode": 0,
  "ReplicaElectionResults": [{
      "Topic": "orders",
      "PartitionResult": [{
          "PartitionId": 1,
          "ErrorCode": 0,
          "ErrorMessage": "NETWORK_EXCEPTION"
      }]
  }]
}