AlterPartition
This page encodes the smallest legal instance of the request and the response: numeric fields are zero, strings and byte arrays are empty, every array carries exactly one sample element, and any records field holds one empty 61-byte RecordBatch v2. Version 3 is a flexible version, so every struct is terminated by a uvarint tagged-field count and strings and arrays carry compact length-plus-one prefixes. Sizes below include the leading int32 size prefix.
- API key
- 56
- Encoded at
- v3
- Flexible versions
- 0+
- Headers
- req v2, resp v1
- Request versions
- 2-3
- Response versions
- 2-3
- Request size
- 75 bytes
- Response size
- 60 bytes
framerpc headerrequest bodyRecordBatchRecordresponse bodytagged_fields
Request
AlterPartitionRequest v3, request header v2, 75 bytes on the wire
byte layout (75 bytes, 16 bytes per row)
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010
0020
0030
0040
object tree
AlterPartitionRequest message v3 [0x0000, 75B] +-- Frame [0x0000, 4B] length-delimited framing | +-- size int32 = 71 [0x0000, 4B] number of bytes that follow, patched after encoding +-- RequestHeader v2 [0x0004, 11B] common request header | +-- request_api_key int16 = 56 (AlterPartition) [0x0004, 2B] numeric id of the API being invoked | +-- request_api_version int16 = 3 [0x0006, 2B] version of the API being invoked | +-- correlation_id int32 = 0 [0x0008, 4B] echoed back by the broker in the response | +-- client_id nullable_string = "" (int16 len=0) [0x000c, 2B] always a non-flexible int16-prefixed string | +-- tagged_fields uvarint = 0 [0x000e, 1B] number of tagged fields in the header +-- AlterPartitionRequest struct [0x000f, 60B] message body, version 3 +-- BrokerId int32 = 0 [0x000f, 4B] The ID of the requesting broker. +-- BrokerEpoch int64 = 0 [0x0013, 8B] The epoch of the requesting broker. +-- Topics []TopicData = 1 element [0x001b, 47B] The topics to alter ISRs for. | +-- length uvarint = 2 (compact, n+1) [0x001b, 1B] one sample element follows | +-- TopicData[0] TopicData = struct [0x001c, 46B] | +-- TopicId uuid = 00000000-0000-0000-0000-000000000000 [0x001c, 16B] The ID of the topic to alter ISRs for. | +-- Partitions []PartitionData = 1 element [0x002c, 29B] The partitions to alter ISRs for. | | +-- length uvarint = 2 (compact, n+1) [0x002c, 1B] one sample element follows | | +-- PartitionData[0] PartitionData = struct [0x002d, 28B] | | +-- PartitionIndex int32 = 0 [0x002d, 4B] The partition index. | | +-- LeaderEpoch int32 = 0 [0x0031, 4B] The leader epoch of this partition. | | +-- NewIsrWithEpochs []BrokerState = 1 element [0x0035, 14B] The ISR for this partition. | | | +-- length uvarint = 2 (compact, n+1) [0x0035, 1B] one sample element follows | | | +-- BrokerState[0] BrokerState = struct [0x0036, 13B] | | | +-- BrokerId int32 = 0 [0x0036, 4B] The ID of the broker. | | | +-- BrokerEpoch int64 = 0 [0x003a, 8B] The epoch of the broker. It will be -1 if the epoch check is not supported. | | | +-- tagged_fields uvarint = 0 [0x0042, 1B] number of tagged fields in this struct | | +-- LeaderRecoveryState int8 = 0 [0x0043, 1B] 1 if the partition is recovering from an unclean leader election; 0 otherwise. | | +-- PartitionEpoch int32 = 0 [0x0044, 4B] The expected epoch of the partition which is being updated. | | +-- tagged_fields uvarint = 0 [0x0048, 1B] number of tagged fields in this struct | +-- tagged_fields uvarint = 0 [0x0049, 1B] number of tagged fields in this struct +-- tagged_fields uvarint = 0 [0x004a, 1B] number of tagged fields in this struct
kafka message schema (.json)
{ "apiKey": 56, "type": "request", "listeners": ["controller"], "name": "AlterPartitionRequest", // Versions 0-1 were removed in Apache Kafka 4.0, version 2 is the new baseline. // Version 1 adds LeaderRecoveryState field (KIP-704). // Version 2 adds TopicId field to replace TopicName field (KIP-841). // // Version 3 adds the NewIsrEpochs field and deprecates the NewIsr field (KIP-903). "validVersions": "2-3", "flexibleVersions": "0+", "fields": [ { "name": "BrokerId", "type": "int32", "versions": "0+", "entityType": "brokerId", "about": "The ID of the requesting broker." }, { "name": "BrokerEpoch", "type": "int64", "versions": "0+", "default": "-1", "about": "The epoch of the requesting broker." }, { "name": "Topics", "type": "[]TopicData", "versions": "0+", "about": "The topics to alter ISRs for.", "fields": [ { "name": "TopicId", "type": "uuid", "versions": "2+", "ignorable": true, "about": "The ID of the topic to alter ISRs for." }, { "name": "Partitions", "type": "[]PartitionData", "versions": "0+", "about": "The partitions to alter ISRs for.", "fields": [ { "name": "PartitionIndex", "type": "int32", "versions": "0+", "about": "The partition index." }, { "name": "LeaderEpoch", "type": "int32", "versions": "0+", "about": "The leader epoch of this partition." }, { "name": "NewIsr", "type": "[]int32", "versions": "0-2", "entityType": "brokerId", "about": "The ISR for this partition. Deprecated since version 3." }, { "name": "NewIsrWithEpochs", "type": "[]BrokerState", "versions": "3+", "about": "The ISR for this partition.", "fields": [ { "name": "BrokerId", "type": "int32", "versions": "3+", "entityType": "brokerId", "about": "The ID of the broker." }, { "name": "BrokerEpoch", "type": "int64", "versions": "3+", "default": "-1", "about": "The epoch of the broker. It will be -1 if the epoch check is not supported." } ]}, { "name": "LeaderRecoveryState", "type": "int8", "versions": "1+", "default": "0", "about": "1 if the partition is recovering from an unclean leader election; 0 otherwise." }, { "name": "PartitionEpoch", "type": "int32", "versions": "0+", "about": "The expected epoch of the partition which is being updated." } ]} ]} ] }
Response
AlterPartitionResponse v3, response header v1, 60 bytes on the wire
byte layout (60 bytes, 16 bytes per row)
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010
0020
0030
object tree
AlterPartitionResponse message v3 [0x0000, 60B] +-- Frame [0x0000, 4B] length-delimited framing | +-- size int32 = 56 [0x0000, 4B] number of bytes that follow, patched after encoding +-- ResponseHeader v1 [0x0004, 5B] common response header | +-- correlation_id int32 = 0 [0x0004, 4B] matches the correlation_id of the request | +-- tagged_fields uvarint = 0 [0x0008, 1B] number of tagged fields in the header +-- AlterPartitionResponse struct [0x0009, 51B] message body, version 3 +-- ThrottleTimeMs int32 = 0 [0x0009, 4B] The duration in milliseconds for which the request was throttled due to a q... +-- ErrorCode int16 = 0 [0x000d, 2B] The top level response error code. +-- Topics []TopicData = 1 element [0x000f, 44B] The responses for each topic. | +-- length uvarint = 2 (compact, n+1) [0x000f, 1B] one sample element follows | +-- TopicData[0] TopicData = struct [0x0010, 43B] | +-- TopicId uuid = 00000000-0000-0000-0000-000000000000 [0x0010, 16B] The ID of the topic. | +-- Partitions []PartitionData = 1 element [0x0020, 26B] The responses for each partition. | | +-- length uvarint = 2 (compact, n+1) [0x0020, 1B] one sample element follows | | +-- PartitionData[0] PartitionData = struct [0x0021, 25B] | | +-- PartitionIndex int32 = 0 [0x0021, 4B] The partition index. | | +-- ErrorCode int16 = 0 [0x0025, 2B] The partition level error code. | | +-- LeaderId int32 = 0 [0x0027, 4B] The broker ID of the leader. | | +-- LeaderEpoch int32 = 0 [0x002b, 4B] The leader epoch. | | +-- Isr []int32 = 1 element [0x002f, 5B] The in-sync replica IDs. | | | +-- length uvarint = 2 (compact, n+1) [0x002f, 1B] one sample element follows | | | +-- int32[0] int32 = 0 [0x0030, 4B] | | +-- LeaderRecoveryState int8 = 0 [0x0034, 1B] 1 if the partition is recovering from an unclean leader election; 0 otherwise. | | +-- PartitionEpoch int32 = 0 [0x0035, 4B] The current epoch for the partition for KRaft controllers. | | +-- tagged_fields uvarint = 0 [0x0039, 1B] number of tagged fields in this struct | +-- tagged_fields uvarint = 0 [0x003a, 1B] number of tagged fields in this struct +-- tagged_fields uvarint = 0 [0x003b, 1B] number of tagged fields in this struct
kafka message schema (.json)
{ "apiKey": 56, "type": "response", "name": "AlterPartitionResponse", // Versions 0-1 were removed in Apache Kafka 4.0, version 2 is the new baseline. // Version 1 adds LeaderRecoveryState field (KIP-704). // Version 2 adds TopicId field to replace TopicName field, can return the following new errors: // INELIGIBLE_REPLICA, NEW_LEADER_ELECTED and UNKNOWN_TOPIC_ID (KIP-841). // // Version 3 is the same as version 2 (KIP-903). "validVersions": "2-3", "flexibleVersions": "0+", "fields": [ { "name": "ThrottleTimeMs", "type": "int32", "versions": "0+", "about": "The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota." }, { "name": "ErrorCode", "type": "int16", "versions": "0+", "about": "The top level response error code." }, { "name": "Topics", "type": "[]TopicData", "versions": "0+", "about": "The responses for each topic.", "fields": [ { "name": "TopicId", "type": "uuid", "versions": "2+", "ignorable": true, "about": "The ID of the topic." }, { "name": "Partitions", "type": "[]PartitionData", "versions": "0+", "about": "The responses for each partition.", "fields": [ { "name": "PartitionIndex", "type": "int32", "versions": "0+", "about": "The partition index." }, { "name": "ErrorCode", "type": "int16", "versions": "0+", "about": "The partition level error code." }, { "name": "LeaderId", "type": "int32", "versions": "0+", "entityType": "brokerId", "about": "The broker ID of the leader." }, { "name": "LeaderEpoch", "type": "int32", "versions": "0+", "about": "The leader epoch." }, { "name": "Isr", "type": "[]int32", "versions": "0+", "entityType": "brokerId", "about": "The in-sync replica IDs." }, { "name": "LeaderRecoveryState", "type": "int8", "versions": "1+", "default": "0", "ignorable": true, "about": "1 if the partition is recovering from an unclean leader election; 0 otherwise." }, { "name": "PartitionEpoch", "type": "int32", "versions": "0+", "about": "The current epoch for the partition for KRaft controllers." } ]} ]} ] }