Skip to content

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
Preethi-Sundaravelu:KAFKA-reset-app-validation
Open

KAFKA-14922: Fail fast if application.id does not exist as consumer group in StreamsResetter#21826
Preethi-Sundaravelu wants to merge 2 commits intoapache:trunkfrom
Preethi-Sundaravelu:KAFKA-reset-app-validation

Conversation

@Preethi-Sundaravelu
Copy link

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:
Screenshot 2026-03-19 at 12 34 08 PM

@github-actions github-actions bot added triage PRs from the community tools labels Mar 19, 2026
@mjsax mjsax changed the title Fail fast if application.id does not exist as consumer group in StreamsResetter KAFKA-14922: Fail fast if application.id does not exist as consumer group in StreamsResetter Mar 20, 2026
@mjsax mjsax added ci-approved streams and removed triage PRs from the community labels Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants