Skip to content

[Bug] Retain highest offset for out-of-order ProcessQueue batches - #11035

Open
zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/process-queue-max-offset
Open

[Bug] Retain highest offset for out-of-order ProcessQueue batches#11035
zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/process-queue-max-offset

Conversation

@zjncs

@zjncs zjncs commented Sep 5, 2026

Copy link
Copy Markdown

Fixes #10870

ProcessQueue.putMessage now updates queueOffsetMax with Math.max instead of overwriting it for every inserted message. An out-of-order batch can therefore no longer make removeMessage return a stale next offset.

Added a regression test inserting offsets 10 then 5 and asserting the drained next offset is 11.

Verification: git diff --check passed; Maven unavailable locally, CI should run ProcessQueueTest/client checks. AI-assisted contribution.

Signed-off-by: zjncs <18910855655@163.com>
@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:29

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

Correct fix — when inserting out-of-order messages, queueOffsetMax should retain the highest offset, not just the last one processed. Using Math.max() ensures correctness regardless of insertion order.

The test validates the fix with out-of-order offsets (10, 5) and verifies the returned offset is 11 (max + 1).

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] ProcessQueue may return a stale next offset for out-of-order messages

3 participants