[ISSUE #10756] Fix duplicate dispatch ConsumeQueueExt leak - #10759
Open
ai-yang wants to merge 1 commit into
Open
[ISSUE #10756] Fix duplicate dispatch ConsumeQueueExt leak#10759ai-yang wants to merge 1 commit into
ai-yang wants to merge 1 commit into
Conversation
Signed-off-by: Rui <1685901819@qq.com>
ai-yang
marked this pull request as ready for review
August 2, 2026 14:23
RockteMQ-AI
reviewed
Aug 2, 2026
RockteMQ-AI
left a comment
Contributor
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Prevents ConsumeQueueExt orphan entries when duplicate dispatch requests arrive by extracting isDispatchAlreadyApplied() and applying it consistently in both the ext-write guard and the main dispatch path.
Findings
- [Info]
ConsumeQueue.java:730— The newisDispatchAlreadyApplied()extraction is clean and ensures bothputMessagePositionInfoWrapperandputMessagePositionInfouse the same duplicate check. Good consolidation. - [Info]
ConsumeQueue.java:901— The helper method is well-named and the semantics are clear (offset + size <= maxPhysicOffsetmeans the dispatch was already applied). - [Info]
ConsumeQueueTest.java— TesttestDuplicateDispatchDoesNotLeaveConsumeQueueExtOrphandirectly verifies the fix scenario with ext address validation after reload. Solid coverage.
Suggestions
- Consider adding a brief Javadoc on
isDispatchAlreadyApplied()explaining that it detects duplicate dispatch after broker crash recovery, to help future readers understand why the check matters in both call sites.
Automated review by github-manager-bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Issue(s) This PR Fixes
Fixes #10756
Brief Description
ConsumeQueue.putMessagePositionInfoWrapper()allocated aConsumeQueueExtunit before the main CQ idempotency check. Replaying a duplicate dispatch therefore skipped the CQ append but still left an unreferenced Ext unit, which a later valid dispatch could seal inside the live Ext range.This change reuses the main CQ physical-end idempotency predicate before allocating an Ext unit. Duplicate replay still follows the existing successful wrapper path, so checkpoint advancement and multi-dispatch behavior are preserved while the orphan allocation is avoided.
How Did You Test This Change?
develop: the deterministic duplicate-dispatch regression failed in 5/5 isolated JDK 8 Maven processes.ConsumeQueueTest: 11/11.store -am test: common 241/241, remoting 174/174, and store 314 tests with 4 skips, 0 failures, and 0 errors.git diff --check: passed.