Table of Contents |
---|
Status
Current state: Under DiscussionAccepted
Discussion thread: here
JIRA: KAFKA-5856
...
Anchor | ||||
---|---|---|---|---|
|
CreatePartitionsRequest
is used to increase the partition count for a batch of topics, and is the basis for the AdminClient.createPartitions()
method.The request can must be sent to any brokerthe controller.
The request will require the ALTER
operation on the Topic
resource.
The request is subject to the CreateTopicPolicy
of the broker as configured by the broker's create.topic.policy.class.name
config property. This is to ensure that the policy applies to topics modified after creation.
After validating the request the broker calls AdminUtils.addPartitions()
which ultimately updates the topic partition assignment znode (/brokers/topics/${topic}
).
The controller then waits for the change to the number of partitions to be reflected in its metadata cache before sending the CreatePartitionsResponse
.
No Format |
---|
CreatePartitionsRequest => [topic_partition_count] timeout topic_partition_count => topic partition_count topic => STRING partition_count => count [assignment] count => INT32 assignment => [INT32] timeout => INT32 |
...
Field | Description |
---|---|
topic | the name of a topic |
count | the new partition count |
assignment | a list of assigned brokers (one list for each new partition) |
timeout | The maximum time to await a response in ms. |
Note: When a NewPartitions
is constructed without a newAssignments
array it results in a null assignment
array in the CreatePartitionsRequest
.
Anchor | ||||
---|---|---|---|---|
|
...
TOPIC_AUTHORIZATION_FAILED
(29) The user lacked Alter on the topicPOLICY_VIOLATION(44) The request violated the configured policy
INVALID_TOPIC_EXCEPTION
(17) If the topic doesn't existINVALID_PARTITIONS
(37) If the partitioncount
was <= the current partition count for the topic.- INVALID_REPLICA_ASSIGNMENT (39) if the size of any of the lists contained in the
partitions
list was not equal to the topic replication factor. INVALID_REQUEST
(42) If duplicate topics appeared in the request, or the size of thepartitions
list did not equal the number of new partitions, or if the size of any of the lists contained in thepartitions
list was not equal to the topic replication factorREASSIGNMENT_IN_PROGRESS
(new) If a partition reassignment is in progress. It is necessary to prevent increasing partitions at the same time so that we can be sure the partition has a meaningful replication factor.NONE
(0) The topic partition count was changed successfully.
...