[ISSUE #10577] Keep reentrant POP receives broker sticky#10652
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Fixes broker selection for reentrant orderly POP receives by adding a brokerSticky mode to ReceiveMessageQueueSelector. When a FIFO retry carries an attemptId, the selector now stays pinned to the target broker instead of silently falling back to another broker — which would lose access to broker-local OrderInfo and block the FIFO queue.
Findings
- [Info]
ReceiveMessageActivity.java:236-238— WhenbrokerSticky=trueand the broker is not found,select()returnsnull. Callers must handle this gracefully (e.g., return an error to the client rather than NPE). The PR description implies this is the intended behavior, so it looks correct. - [Info] The condition
fifo && request.hasAttemptId()is well-scoped — it only activates sticky mode for reentrant FIFO requests, preserving the existing fallback path for all other cases.
Suggestions
- Minor: consider adding a brief Javadoc on the
brokerStickyparameter in the two-arg constructor to clarify the contract (returnsnullwhen the target broker is unavailable, rather than falling back).
Overall this is a clean, focused fix with good test coverage. LGTM.
Automated review by github-manager-bot
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #10652 +/- ##
=============================================
- Coverage 48.32% 48.20% -0.13%
+ Complexity 13490 13473 -17
=============================================
Files 1380 1380
Lines 101031 101097 +66
Branches 13092 13104 +12
=============================================
- Hits 48825 48730 -95
- Misses 46247 46374 +127
- Partials 5959 5993 +34 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Adds broker-sticky behavior to ReceiveMessageQueueSelector for reentrant POP receives: when a message is FIFO and has an attemptId, the selector will stick to the same broker even if the preferred broker's queue is not available (returns null instead of falling through to random selection).
Findings
- [Warning]
ReceiveMessageActivity.java:239-242— The new logic: ifbrokerStickyis true and the broker-name lookup returns null, it still returns null instead of falling through togetRandomOne(). This means for FIFO messages withattemptId, if the preferred broker is unavailable, the receive will get a null queue. Verify that the caller handles this null gracefully (e.g., retries or returns an empty response rather than NPE). - [Info]
ReceiveMessageActivity.java:145— Thefifo && request.hasAttemptId()condition is a reasonable trigger for broker stickiness. FIFO ordering requires the same broker to maintain message ordering guarantees. - [Info] Backward-compatible constructor
ReceiveMessageQueueSelector(String brokerName)delegates to the new constructor withbrokerSticky=false, preserving existing behavior for non-FIFO cases. - [Info] Tests cover both the sticky and non-sticky paths.
Suggestions
Consider adding a null check or comment at the call site where select() returns null for the sticky case, to make it explicit that this is intentional (not a bug).
Verdict
Reasonable change for FIFO ordering guarantees. The main concern is ensuring callers handle the null queue case properly.
Automated review by github-manager-bot
3b72e7b to
2db245b
Compare
2db245b to
a998906
Compare
|
Addressed the review feedback in
Local verification: |
Summary
Fixes #10577.
This change keeps reentrant orderly POP receive requests broker-sticky when the request carries an
attemptId.Motivation
Reentrant orderly POP depends on broker-local order state. If a retry with the same
attemptIdasks for a specific broker but the selector silently falls back to another broker, the retry can lose access to the original broker-localOrderInfoand leave the FIFO queue blocked until invisible time expires.Changes
ReceiveMessageQueueSelectoronly for FIFO receive requests carryingattemptId.nullinstead of falling back to another broker.ReceiveMessageActivityTestto cover both fallback and sticky-missing-broker behavior.Verification
git diff --checkis clean.