Skip to content

[ISSUE #10987] Preserve offsets during correction query - #11020

Open
zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/query-correction-offset-preserve-groups
Open

[ISSUE #10987] Preserve offsets during correction query#11020
zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/query-correction-offset-preserve-groups

Conversation

@zjncs

@zjncs zjncs commented Sep 5, 2026

Copy link
Copy Markdown

Which Issue(s) This PR Fixes

Fixes #10987

Brief Description

ConsumerOffsetManager.queryMinOffsetInAllGroup iterated the live offsetTable.keySet() view and removed matching groups while answering a correction-offset query. The iterator removal and removeConsumerOffset call permanently deleted consumer offsets as a read-side effect.

Copy the key set before filtering and remove matching keys only from that temporary set. The live offset table is now left unchanged while the query excludes the requested groups from its calculation.

How Did You Test This Change?

  • Base SHA: $(git rev-parse develop).
  • Confirmed current code assigned offsetTable.keySet() directly and called removeConsumerOffset during the query.
  • git diff --check passed.
  • Maven is unavailable in this environment, so the required test suite was not run; CI should validate.

Risk

Low; this removes an unintended destructive side effect from a read/query operation while preserving filtering behavior.

AI-assisted contribution; implementation and verification performed against current develop.

Signed-off-by: zjncs <18910855655@163.com>
@zjncs
zjncs force-pushed the fix/query-correction-offset-preserve-groups branch from 6b62319 to ceec0f3 Compare September 5, 2026 07:00
@zjncs
zjncs marked this pull request as ready for review September 5, 2026 09:29
Copilot AI lite review requested due to automatic review settings September 5, 2026 09:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR fixes two related issues in the offset correction query path:

  1. ConcurrentModificationException prevention: Wraps offsetTable.keySet() in new HashSet<>(...) to create a defensive copy before iterating. This prevents CME when entries are removed during iteration.

  2. Incorrect offset deletion: Removes the removeConsumerOffset(topicAtGroup) call inside the correction loop, which was deleting offsets that should be preserved.

Both fixes are correct and address real bugs in the offset management logic.

LGTM.


Automated review by github-manager-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] QUERY_CORRECTION_OFFSET admin query permanently deletes the filtered groups' consumer offsets

3 participants