-
Notifications
You must be signed in to change notification settings - Fork 143
[ISSUE #2388]Fix PopMessageProcessor popMsgFromQueue bug #2389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis pull request modifies the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
🔊@mxsm 🚀Thanks for your contribution🎉! 💡CodeRabbit(AI) will review your code first🔥! Note 🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2389 +/- ##
=======================================
Coverage 28.63% 28.63%
=======================================
Files 507 507
Lines 73304 73304
=======================================
Hits 20988 20988
Misses 52316 52316 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (3)
rocketmq-broker/src/processor/pop_message_processor.rs (3)
Line range hint
1069-1583
: Improve test coverage for core message processing logic.While there is good test coverage for utility functions (ID generation, locking), the core message processing logic lacks tests. Consider adding tests for:
- Message popping logic and stopping conditions
- Checkpoint handling and verification
- Message notification system
- Error scenarios and edge cases
Would you like me to help generate comprehensive test cases for the core message processing logic?
Critical: Confirmed unimplemented notification function
The
notify_message_arriving
function inpop_message_processor.rs
is indeed unimplemented but is called from multiple locations. It should be implemented by delegating to the existing notification logic inPopLongPollingService
.
- Location:
rocketmq-broker/src/processor/pop_message_processor.rs
- Current implementation:
unimplemented!("PopMessageProcessor notify_message_arriving")
- Called from:
pop_message_processor.rs
ack_message_processor.rs
🔗 Analysis chain
Line range hint
1063-1068
: Critical: Implement thenotify_message_arriving
function.The
notify_message_arriving
function is unimplemented but is essential for notifying consumers about new messages. The current implementation only logs the notification without actually notifying consumers.Let's search for any existing notification implementations:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for message notification implementations # Test 1: Search for notification-related code rg -A 5 'notify_message_arriving|message.*notify' # Test 2: Search for notification patterns ast-grep --pattern 'fn notify_$_($$$) { $$$ }'Length of output: 6763
Critical: Implement
append_check_point
in PopMessageProcessorThe
append_check_point
function inpop_message_processor.rs
is indeed unimplemented, which affects core message processing functionality. However, note that checkpoint functionality is properly implemented in other components likechange_invisible_time_processor.rs
, so this is a localized issue specific to the PopMessageProcessor component.
- Location:
rocketmq-broker/src/processor/pop_message_processor.rs
- Function:
append_check_point
🔗 Analysis chain
Line range hint
1048-1061
: Critical: Implement theappend_check_point
function.The
append_check_point
function is unimplemented but is critical for tracking message processing state. This function is called during message popping to maintain checkpoints for message processing progress.Let's search for any existing checkpoint implementations:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for checkpoint implementations and references # Test 1: Search for checkpoint-related code rg -A 5 'append_check_point|check_point' # Test 2: Search for checkpoint struct usage ast-grep --pattern 'struct $_ { $$$, check_point: $_, $$$ }'Length of output: 21128
Script:
#!/bin/bash # Check implementation of append_check_point in both files # Search for append_check_point function implementation in pop_message_processor.rs echo "=== pop_message_processor.rs implementation ===" ast-grep --pattern 'fn append_check_point($$$) { $$$ }' rocketmq-broker/src/processor/pop_message_processor.rs echo -e "\n=== change_invisible_time_processor.rs implementation ===" ast-grep --pattern 'fn append_check_point($$$) { $$$ }' rocketmq-broker/src/processor/change_invisible_time_processor.rsLength of output: 471
Script:
#!/bin/bash # Search for append_check_point function with context echo "=== pop_message_processor.rs implementation ===" rg -A 10 "fn append_check_point" rocketmq-broker/src/processor/pop_message_processor.rs echo -e "\n=== change_invisible_time_processor.rs implementation ===" rg -A 10 "fn append_check_point" rocketmq-broker/src/processor/change_invisible_time_processor.rsLength of output: 1067
Script:
#!/bin/bash # Search for complete append_check_point implementations echo "=== pop_message_processor.rs implementation ===" rg -A 30 "fn append_check_point" rocketmq-broker/src/processor/pop_message_processor.rs echo -e "\n=== change_invisible_time_processor.rs implementation ===" rg -A 30 "fn append_check_point" rocketmq-broker/src/processor/change_invisible_time_processor.rsLength of output: 2368
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
rocketmq-broker/src/processor/pop_message_processor.rs
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: build (windows-latest, nightly)
- GitHub Check: build (windows-latest, stable)
- GitHub Check: build (macos-latest, nightly)
- GitHub Check: build (macos-latest, stable)
- GitHub Check: build (ubuntu-latest, nightly)
- GitHub Check: test
- GitHub Check: build (ubuntu-latest, stable)
- GitHub Check: build
- GitHub Check: auto-approve
@@ -868,7 +868,7 @@ | |||
self.queue_lock_manager() | |||
.unlock_with_key(lock_key.clone()) | |||
.await; | |||
if !self.is_pop_should_stop(topic, &request_header.consumer_group, queue_id) { | |||
if self.is_pop_should_stop(topic, &request_header.consumer_group, queue_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Critical: Implement is_pop_should_stop
based on Java reference implementation
The function should check if pop message threshold is enabled and if the number of in-flight messages exceeds the threshold. Implementation guidance:
- Access broker configuration to check if pop message threshold is enabled
- Use in-flight message counter to get the number of in-flight messages for the given topic, group, and queue
- Return true if threshold is enabled and in-flight messages exceed the configured threshold
Example from Java implementation:
return brokerController.getBrokerConfig().isEnablePopMessageThreshold() &&
brokerController.getPopInflightMessageCounter().getGroupPopInFlightMessageNum(topic, group, queueId) >
brokerController.getBrokerConfig().getPopInflightMessageThreshold();
🔗 Analysis chain
Critical: Implement the is_pop_should_stop
function.
The is_pop_should_stop
function is marked as unimplemented, which is a critical issue as it's used to control the message popping flow. This function needs to be implemented to properly handle the stopping condition.
Let's verify if there are any existing implementations or references to guide the implementation:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Search for any existing implementations or references of is_pop_should_stop
# Test 1: Search for any existing implementations
rg -A 5 'is_pop_should_stop'
# Test 2: Search for any references to stopping conditions in pop message processing
ast-grep --pattern 'fn $_(topic: &CheetahString, group: &CheetahString, queue_id: i32) -> bool'
Length of output: 1636
Script:
#!/bin/bash
# Search for Java implementation of PopMessageProcessor and its stopping condition
# Clone the RocketMQ Java repository
git clone --depth 1 https://github.com/apache/rocketmq.git java-rocketmq
cd java-rocketmq
# Search for PopMessageProcessor and related stopping conditions
rg -t java -A 10 "class PopMessageProcessor"
rg -t java "shouldStop|isPopShouldStop" -A 5
Length of output: 8353
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Which Issue(s) This PR Fixes(Closes)
Fixes #2388
Brief Description
How Did You Test This Change?
Summary by CodeRabbit