conduktor.io ↗

Kafka AlterPartition Request Wire Format v3 — Binary Protocol Layout

What is AlterPartition?

Brokers notify the KRaft controller of ISR changes through this API when a follower catches up (expansion) or falls behind (shrink). This replaced the ZooKeeper watcher-based ISR change path; in KRaft mode, all ISR changes flow here, making them serializable and auditable.

Related Errors

INELIGIBLE_REPLICA · NEW_LEADER_ELECTED

Wire Diagram

Request Header · flexible
message_size int32 · 4B
api_key int16 · 2B
api_version int16 · 2B
correlation_id int32 · 4B
client_id string (compact)
tagged var
AlterPartitionRequest v3
BrokerId int32 · 4B
BrokerEpoch int64 · 8B
Topics array
tagged var
TopicId uuid · 16B
Partitions array
tagged var
PartitionIndex int32 · 4B
LeaderEpoch int32 · 4B
NewIsrWithEpochs array
LeaderRecoveryState int8 · 1B
PartitionEpoch int32 · 4B
tagged var
BrokerId int32 · 4B
BrokerEpoch int64 · 8B
tagged var

Schema & Example

Schema
{
  "BrokerId": int32,
  "BrokerEpoch": int64,
  "Topics": [{
      "TopicId": uuid,
      "Partitions": [{
          "PartitionIndex": int32,
          "LeaderEpoch": int32,
          "NewIsrWithEpochs": [{
              "BrokerId": int32,
              "BrokerEpoch": int64
          }],
          "LeaderRecoveryState": int8,
          "PartitionEpoch": int32
      }]
  }]
}
Example
{
  "BrokerId": 1,
  "BrokerEpoch": 12,
  "Topics": [{
      "TopicId": "550e8400-e29b-41d4-a716-446655440000",
      "Partitions": [{
          "PartitionIndex": 3,
          "LeaderEpoch": 17,
          "NewIsrWithEpochs": [{
              "BrokerId": 1,
              "BrokerEpoch": 12
          }],
          "LeaderRecoveryState": 1,
          "PartitionEpoch": 12
      }]
  }]
}