gyh-hhz opened a new pull request, #11582: URL: https://github.com/apache/rocketmq/pull/11582
### Which Issue(s) This PR Fixes - Fixes #10987 ### Brief Description `ConsumerOffsetManager#queryMinOffsetInAllGroup(topic, filterGroups)` is invoked by the read-only admin query `AdminBrokerProcessor#queryCorrectionOffset` (`RequestCode.QUERY_CORRECTION_OFFSET`). Previously, it obtained `Set<String> topicGroups = this.offsetTable.keySet()`—which is a live view backed by `this.offsetTable`—and called `it.remove()` plus `removeConsumerOffset(topicAtGroup)` for every `topic@group` matching `filterGroups`. As a result, running `QUERY_CORRECTION_OFFSET` permanently deleted all consumer offsets of the filtered groups across every topic on the broker (both in memory/JSON persistence and immediately in RocksDB via `RocksDBConsumerOffsetManager` / `ConsumerOffsetManagerV2`). In addition, `topicAtGroup.split(TOPIC_GROUP_SEPARATOR)[1]` threw `ArrayIndexOutOfBoundsException` if any key without `@` existed in `offsetTable`. This PR collects `filterGroups` into a local `excludedGroups` set and skips excluded groups as well as malformed keys (`topicGroupArr.length == 2`) during the read-only `offsetTable` scan, leaving `offsetTable` and persisted RocksDB offsets untouched. ### How Did You Test This Change? - Added `ConsumerOffsetManagerTest#testQueryMinOffsetInAllGroupPreservesFilteredGroups`: verifies filtered groups are excluded from the returned min offsets while their in-memory offsets (across all topics), `removeConsumerOffset` hook, and malformed keys remain untouched. - Added `RocksDBConsumerOffsetManagerTest#testQueryMinOffsetInAllGroupPreservesRocksDBOffsets`: verifies `RocksDBConsumerOffsetManager` preserves persisted RocksDB offsets of filtered groups across broker restart/reload after `queryMinOffsetInAllGroup`. - Ran `ConsumerOffsetManagerTest`, `RocksDBConsumerOffsetManagerTest`, `LmqConsumerOffsetManagerTest`, `ConsumerOffsetManagerV2Test`, and `AdminBrokerProcessorTest#testQueryCorrectionOffset` with Checkstyle (`0 violations`) and SpotBugs (`0 warnings`). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
