conduktor.io ↗

Kafka CreatePartitions Request Wire Format v1 — Binary Protocol Layout

What is CreatePartitions?

Increases a topic's partition count via kafka-topics.sh --alter --partitions. Partition count can only go up, never down. Adding partitions breaks message ordering for keys previously co-located on the same partition (key-based producers must rehash), so coordinate carefully.

Related Errors

INVALID_PARTITIONS · NOT_CONTROLLER

Wire Diagram

Request Header
message_size int32 · 4B
api_key int16 · 2B
api_version int16 · 2B
correlation_id int32 · 4B
client_id string
CreatePartitionsRequest v1
Topics array
TimeoutMs int32 · 4B
ValidateOnly bool · 1B
Name string
Count int32 · 4B
Assignments? array
BrokerIds []int32

Schema & Example

Schema
{
  "Topics": [{
      "Name": string,
      "Count": int32,
      "Assignments": [{
          "BrokerIds": [int32]
      }]?
  }],
  "TimeoutMs": int32,
  "ValidateOnly": bool
}
Example
{
  "Topics": [{
      "Name": "orders",
      "Count": 10,
      "Assignments": [{
          "BrokerIds": [1, 2, 3]
      }]?
  }],
  "TimeoutMs": 30000,
  "ValidateOnly": true
}