Skip to content

fix(inkless): reject topic creation with config conflicting with diskless regex#642

Merged
tvainika merged 1 commit into
mainfrom
gqmelo/reject-explicit-diskless-false-matching-regex
Jun 15, 2026
Merged

fix(inkless): reject topic creation with config conflicting with diskless regex#642
tvainika merged 1 commit into
mainfrom
gqmelo/reject-explicit-diskless-false-matching-regex

Conversation

@gqmelo

@gqmelo gqmelo commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

If a create topic request includes diskless.enable=false, but the topic name matches one of the diskless.force.include.topic.regexes, it is unclear what the real intent is.

Since this is mostly likely an user mistake, let's be stricter for now and reject the request to let the user know the topic would likely be created in a different way than they expected.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens CREATE_TOPICS validation by rejecting requests that explicitly set diskless.enable=false for topic names that match the configured diskless-force include regexes, preventing ambiguous intent and surprising topic creation behavior.

Changes:

  • Make DisklessForceCreateTopicInterceptor throw InvalidRequestException when diskless.enable=false conflicts with diskless-force include regex matching.
  • Catch ApiException from create-topic config interceptors in ReplicationControlManager#createTopics and convert it into a per-topic error response (instead of failing the whole request).
  • Update interceptor unit tests to assert the new rejection behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
metadata/src/main/java/org/apache/kafka/controller/DisklessForceCreateTopicInterceptor.java Reject conflicting diskless.enable=false when forcing would apply.
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java Convert interceptor-thrown ApiException into per-topic ApiError during CreateTopics processing.
metadata/src/test/java/org/apache/kafka/controller/DisklessForceCreateTopicInterceptorTest.java Update tests to expect InvalidRequestException for the conflicting configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…less regex

If a create topic request includes diskless.enable=false, but the
topic name matches one of the diskless.force.include.topic.regexes,
it is unclear what the real intent is.

Since this is mostly likely an user mistake, let's be stricter for now
and reject the request to let the user know the topic would likely
be created in a different way than they expected.
@gqmelo gqmelo force-pushed the gqmelo/reject-explicit-diskless-false-matching-regex branch from dd693e6 to 421ec52 Compare June 12, 2026 12:22
@gqmelo gqmelo marked this pull request as ready for review June 12, 2026 12:23
@gqmelo gqmelo requested a review from giuseppelillo June 12, 2026 12:24
@tvainika

tvainika commented Jun 12, 2026

Copy link
Copy Markdown
Member

Original requirement for #614 was
"Must be configurable by the user, which provides an allow list implemented through a list of regexes: if the topic being created matches at least one of the regexes, then diskless.enable=true is added to the requested configs (even if the request contained diskless.enable=false)" see https://aiven.atlassian.net/browse/KC-21

So this change goes against that requirement.

@gqmelo

gqmelo commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

Original requirement for #614 was "Must be configurable by the user, which provides an allow list implemented through a list of regexes: if the topic being created matches at least one of the regexes, then diskless.enable=true is added to the requested configs (even if the request contained diskless.enable=false)" see https://aiven.atlassian.net/browse/KC-21

So this change goes against that requirement.

Yes, but I think it was written without being discussed. After some discussion, we opted for changing this behaviour.

@tvainika tvainika left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification. LGTM.

@tvainika tvainika merged commit fa61d7c into main Jun 15, 2026
7 checks passed
@tvainika tvainika deleted the gqmelo/reject-explicit-diskless-false-matching-regex branch June 15, 2026 05:41
gqmelo added a commit that referenced this pull request Jun 17, 2026
…less regex (#642)

If a create topic request includes diskless.enable=false, but the
topic name matches one of the diskless.force.include.topic.regexes,
it is unclear what the real intent is.

Since this is mostly likely an user mistake, let's be stricter for now
and reject the request to let the user know the topic would likely
be created in a different way than they expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants