[ISSUE #10114] Support deleting consumer offset by group and topic#10625
[ISSUE #10114] Support deleting consumer offset by group and topic#10625btlqql wants to merge 1 commit into
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
This PR adds a new admin API (DELETE_CONSUMER_OFFSET, request code 380) to delete consumer offsets for a specific group+topic combination. The implementation spans broker, client, remoting, and tools modules with comprehensive test coverage.
Findings
-
[Info]
ConsumerOffsetManager.removeOffset(String group, String topic)— The log message says "clean group and topic offset" while the method name and API are "delete". Consider aligning the terminology for consistency with the existingremoveOffset(String group)method which also uses "clean" in its log. This is a minor style point. -
[Info]
AdminBrokerProcessor.deleteConsumerOffset()— The null check onoffsetManager(line ~1418) returns a response, but the subsequentremoveConsumerOffset(topicAtGroup)call on line ~1424 is only executed whenoffsetManager != null. The logic is correct but could be clearer with an early return pattern or a comment explaining the two-phase cleanup (offset table removal + consumer offset file cleanup). -
[Info]
RequestCode.DELETE_CONSUMER_OFFSET = 380— Fits cleanly in the gap between 370 (RECALL_MESSAGE) and 400 (QUERY_ASSIGNMENT). No conflict.
Positive Notes
- Well-structured implementation following existing patterns (mirrors
DELETE_SUBSCRIPTIONGROUPflow) - Good test coverage across unit tests, processor tests, and tools tests
- Proper use of
@AclValidatorfor authorization DeleteConsumerOffsetRequestHeaderhas appropriate@CFNotNullannotations- Admin tool properly handles the new command
Automated review by github-manager-bot
Problem
A consumer group can accidentally consume a topic, but the current administration API only removes all offsets with the subscription group. Operators cannot clean up one group-topic relationship without affecting the group's progress on unrelated topics.
Closes #10114.
Root cause
Consumer offsets are keyed by topic and group internally, but the broker protocol and mqadmin surface expose only group-wide removal. The precise storage operation was not wired through the broker, client, admin API, and CLI layers.
Changes
Impact
This adds an opt-in administration operation and does not change normal offset commits. It deletes only the selected topic@group offset and leaves the consumer group's offsets for other topics intact. Running consumers can commit the offset again, so operators should stop the affected consumer before cleanup when persistent removal is required.
Validation
Prior work
#10115 previously explored the same issue but was closed without merge. This PR reimplements the feature on current develop and adds explicit target validation, null-response handling, isolation checks, and broker/cluster command coverage.