refactor(metadata:diskless): fail on topic creation with replica assignment#488
Merged
giuseppelillo merged 3 commits intomainfrom Jan 20, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request refactors diskless topic creation to properly reject manual replica assignments, preventing unexpected behavior where assignments were previously ignored. The PR also includes test refactoring and Makefile improvements.
Changes:
- Added validation to reject diskless topic creation requests that include manual replica assignments
- Refactored diskless-related tests into a nested class for better organization
- Enhanced the
make fmttarget to include checkstyle tasks
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java | Added validation logic to reject manual partition assignments for diskless topics and removed the line that was silently clearing assignments |
| metadata/src/test/java/org/apache/kafka/controller/ReplicationControlManagerTest.java | Reorganized diskless tests into a nested class, added helper method for rack-aware broker registration, and added test coverage for the new validation |
| Makefile | Enhanced fmt target to run checkstyle tasks alongside spotless formatting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
eae67b5 to
9448d39
Compare
…y class For easier testing, moving existing tests to a nested class acknowledging the current approach as legacy. This will allow testing existing and new approach correctly.
…assignment Currently, diskless topic creation with replica assignment ignores the assignments and creates topic anyway with default partitions and replication factor. This can lead to unexpected/undesired states. Instead fail and provide error message for users to fix this. Existing tests changed is to align the new behavior.
9448d39 to
473bb96
Compare
giuseppelillo
approved these changes
Jan 20, 2026
giuseppelillo
pushed a commit
that referenced
this pull request
Jan 27, 2026
…gnment (#488) * chore(inkless:build): add checkstyle to fmt make target * chore(metadata:diskless): move diskless-related tests to nested legacy class For easier testing, moving existing tests to a nested class acknowledging the current approach as legacy. This will allow testing existing and new approach correctly. * refactor(metadata:diskless): fail diskless topic creation on replica assignment Currently, diskless topic creation with replica assignment ignores the assignments and creates topic anyway with default partitions and replication factor. This can lead to unexpected/undesired states. Instead fail and provide error message for users to fix this. Existing tests changed is to align the new behavior.
giuseppelillo
pushed a commit
that referenced
this pull request
Jan 27, 2026
…gnment (#488) * chore(inkless:build): add checkstyle to fmt make target * chore(metadata:diskless): move diskless-related tests to nested legacy class For easier testing, moving existing tests to a nested class acknowledging the current approach as legacy. This will allow testing existing and new approach correctly. * refactor(metadata:diskless): fail diskless topic creation on replica assignment Currently, diskless topic creation with replica assignment ignores the assignments and creates topic anyway with default partitions and replication factor. This can lead to unexpected/undesired states. Instead fail and provide error message for users to fix this. Existing tests changed is to align the new behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, diskless topic creation with replica assignment ignores the assignments and creates topic anyway with default partitions and replication factor. This can lead to unexpected/undesired states.
Instead fail and provide error message for users to fix this.
Alongside, a couple of (minor) commits are included in this PR:
Note that tests have not only being moved, but they have been cleaned up and additional cases added to ensure the current behaviors are document by tests.