You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ch...@apache.org on 2026/01/04 14:50:19 UTC
(kafka) branch trunk updated: KAFKA-20021 Document when Admin#createPartitions throws InvalidPartitionsException (#21245)
This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 380cda94c17 KAFKA-20021 Document when Admin#createPartitions throws InvalidPartitionsException (#21245)
380cda94c17 is described below
commit 380cda94c17d23f1702b99b4b437d076e9b4fcff
Author: Parker Chang <pa...@gmail.com>
AuthorDate: Sun Jan 4 22:50:13 2026 +0800
KAFKA-20021 Document when Admin#createPartitions throws InvalidPartitionsException (#21245)
Refer to https://issues.apache.org/jira/browse/KAFKA-20021.
The `Admin#createPartitions` method anticipates an
`InvalidPartitionsException` when the requested partition count is less
than or equal to the current partition count (i.e., decreasing
partitions or keeping the same count is not allowed).
However, this exception was missing from the Javadoc description of the
returned `CreatePartitionsResult`, see
https://kafka.apache.org/41/javadoc/org/apache/kafka/clients/admin/Admin.html#createPartitions.
This PR adds `InvalidPartitionsException` to the Javadoc to clarify this
behavior for users.
Reviewers: Chia-Ping Tsai <ch...@gmail.com>
---
clients/src/main/java/org/apache/kafka/clients/admin/Admin.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/Admin.java b/clients/src/main/java/org/apache/kafka/clients/admin/Admin.java
index 1d90a84a79b..1c025bbd42a 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/Admin.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/Admin.java
@@ -665,6 +665,8 @@ public interface Admin extends AutoCloseable {
* replicas with the topics replication factor.</li>
* <li>Subclasses of {@link org.apache.kafka.common.KafkaException}
* if the request is invalid in some way.</li>
+ * <li>{@link org.apache.kafka.common.errors.InvalidPartitionsException}
+ * if the requested partition count is less than or equal to the current partition count.</li>
* </ul>
*
* @param newPartitions The topics which should have new partitions created, and corresponding parameters