conduktor.io ↗

Kafka OffsetForLeaderEpoch Response Wire Format v3 — Binary Protocol Layout

What is OffsetForLeaderEpoch?

Follower replicas call this after a leader failover to determine the divergence point and truncate their local log to match the new leader. Without it, a follower might replay entries the new leader doesn't have, causing data inconsistency across leader elections.

Related Errors

TOPIC_AUTHORIZATION_FAILED · UNKNOWN_LEADER_EPOCH

Wire Diagram

Response Header
message_size int32 · 4B
correlation_id int32 · 4B
OffsetForLeaderEpochResponse v3
ThrottleTimeMs int32 · 4B
Topics array
Topic string
Partitions array
ErrorCode int16 · 2B
Partition int32 · 4B
LeaderEpoch int32 · 4B
EndOffset int64 · 8B

Schema & Example

Schema
{
  "ThrottleTimeMs": int32,
  "Topics": [{
      "Topic": string,
      "Partitions": [{
          "ErrorCode": int16,
          "Partition": int32,
          "LeaderEpoch": int32,
          "EndOffset": int64
      }]
  }]
}
Example
{
  "ThrottleTimeMs": 0,
  "Topics": [{
      "Topic": "orders",
      "Partitions": [{
          "ErrorCode": 0,
          "Partition": 0,
          "LeaderEpoch": 17,
          "EndOffset": 150382
      }]
  }]
}