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.
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 v2
BrokerId
int32 · 4B
BrokerEpoch
int64 · 8B
tagged
var
TopicId
uuid · 16B
tagged
var
PartitionIndex
int32 · 4B
LeaderEpoch
int32 · 4B
NewIsr
[]int32
LeaderRecoveryState
int8 · 1B
PartitionEpoch
int32 · 4B
tagged
var
Schema & Example
Schema { "BrokerId": int32, "BrokerEpoch": int64, "Topics": [{ "TopicId": uuid, "Partitions": [{ "PartitionIndex": int32, "LeaderEpoch": int32, "NewIsr": [int32], "LeaderRecoveryState": int8, "PartitionEpoch": int32 }] }] }
Example { "BrokerId": 1, "BrokerEpoch": 12, "Topics": [{ "TopicId": "550e8400-e29b-41d4-a716-446655440000", "Partitions": [{ "PartitionIndex": 3, "LeaderEpoch": 17, "NewIsr": [0, 1, 2], "LeaderRecoveryState": 1, "PartitionEpoch": 12 }] }] }