[fix][admin] Allow defaultNumPartitions for non-partitioned autoTopicCreation override#25163
Conversation
…cCreation override
…tioned autoTopicCreation override
6a10c6a to
7a13f42
Compare
|
Updated |
Please add this information to the PR description. |
lhotari
left a comment
There was a problem hiding this comment.
LGTM, thanks for the contribution @ChimdumebiNebolisa
| AutoTopicCreationOverride overridePolicy = AutoTopicCreationOverride.builder() | ||
| .allowAutoTopicCreation(true) | ||
| .topicType(TopicType.NON_PARTITIONED.toString()) | ||
| .defaultNumPartitions(5) | ||
| .build(); | ||
| admin.namespaces().setAutoTopicCreation(namespaceName, overridePolicy); |
There was a problem hiding this comment.
Updated this to address the review comment. The acceptance test now uses 1, and I added a separate test confirming that 5 is rejected with HTTP 412. The targeted tests and quickCheck pass locally. CI is currently awaiting maintainer approval.
…efaultNumPartitions
Co-authored-by: Cursor <cursoragent@cursor.com>
Fixes #24998
Motivation
The namespace
autoTopicCreationoverride validation rejectsdefaultNumPartitionswhenevertopicType=non-partitioned. This forces clients and infrastructure-as-code tools to conditionally omit the field, making shared configuration templates harder to maintain.The relaxation is intentionally narrow. For non-partitioned overrides,
defaultNumPartitionsmay benull,0, or1. Values greater than1remain invalid.Accepted values are persisted as submitted but ignored during runtime topic creation. Auto-created topics therefore remain non-partitioned.
Modifications
AutoTopicCreationOverrideImpl.validateOverrideto allowdefaultNumPartitionsforNON_PARTITIONEDonly when the value isnull,0, or1.0and1are accepted and2is rejected.1is persisted but ignored when the topic is auto-created5is rejected by the admin REST API with HTTP 412Verifying this change
Does this pull request potentially affect one of the following parts:
Documentation
doc-not-needed