KAFKA-14922: Fail fast if application.id does not exist as consumer group in StreamsResetter#21826
Open
Preethi-Sundaravelu wants to merge 2 commits intoapache:trunkfrom
Open
Conversation
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.
kafka-streams-application-reset uses a topic name prefix match to infer
internal topics to delete. This means that running the tool with
--application-id my-app would silently delete internal topics belonging
to my-app-v1 and my-app-v2 — any application whose application.id
shares the same prefix. This is especially dangerous with typos or when
multiple applications share a common naming convention.
Solution
Added a validateApplicationIdExists() method that calls listGroups()
to verify the provided application.id exists as a consumer group before
any topic deletion is attempted. Since Kafka Streams maps application.id
1:1 to consumer group.id, this is a reliable and cheap check.
If the group does not exist → fail fast with a clear error message
If the group exists → proceed as normal
If --force is provided → skip the check (existing behaviour preserved)
Changes
StreamsResetter.java — added validateApplicationIdExists() called
inside execute() before maybeDeleteActiveConsumers()
StreamsResetterTest.java — added 7 test cases covering the fix
Screenshot of output:
