-
Notifications
You must be signed in to change notification settings - Fork 111
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
[ISSUE #2075]💫Implement PopReviveService#getReviveMessage🚀 #2078
Conversation
WalkthroughThis pull request introduces a new asynchronous method 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 #2078 +/- ##
==========================================
- Coverage 28.36% 28.35% -0.02%
==========================================
Files 489 489
Lines 69495 69532 +37
==========================================
Hits 19713 19713
- Misses 49782 49819 +37 ☔ 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
🧹 Nitpick comments (2)
rocketmq-broker/src/processor/processor_service/pop_revive_service.rs (2)
205-207
: Consider adding a debug log or returning early whenreach_tail
is true.
A small debug log would help confirm that the function does nothing intentionally. Without it, debugging might be slightly more difficult to track.if reach_tail(&pull_result, offset) { - //nothing to do + tracing::debug!("Reached tail at offset: {}, no further revival needed.", offset); }
288-292
: Disambiguate boolean expression or add parentheses for clarity.
As written, the expression effectively reads:pull_status == NoNewMsg || (pull_status == OffsetIllegal && offset == max_offset)
Make sure this is the intended logic. If not, consider adding parentheses or splitting conditions into separate
if
statements to avoid confusion.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
rocketmq-broker/src/processor/processor_service/pop_revive_service.rs
(2 hunks)
🔇 Additional comments (2)
rocketmq-broker/src/processor/processor_service/pop_revive_service.rs (2)
195-204
: Validate possible edge cases in pull_result.
Whenget_message
returns aPullResult
, it may have aNone
inmsg_found_list
if no messages were found. Although the function returns anOption<Vec<ArcMut<MessageExt>>>
, ensuring you cover (and potentially log) unexpectedNone
scenarios can improve reliability.Would you like an automated script to locate and log all
None
returns ofget_message
in the codebase for deeper analysis?
221-222
: Implementation looks clean and straightforward.
Returningpull_result.msg_found_list
ensures that message retrieval logic is nicely encapsulated and consistent with the rest of the method flow.
|| pull_result.pull_status == PullStatus::NoMatchedMsg | ||
{ | ||
if !self.should_run_pop_revive { | ||
return None; | ||
} | ||
self.consumer_offset_manager.commit_offset( | ||
CheetahString::from_static_str(PopAckConstants::LOCAL_HOST), | ||
&CheetahString::from_static_str(PopAckConstants::REVIVE_GROUP), | ||
&self.revive_topic, | ||
queue_id, | ||
pull_result.next_begin_offset as i64 - 1, | ||
); | ||
} |
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.
Clamp the committed offset to avoid negative values.
When next_begin_offset
is 0, subtracting 1 results in -1
. Committing a negative offset can lead to unexpected behavior in some storage or offset manager implementations.
- pull_result.next_begin_offset as i64 - 1,
+ (pull_result.next_begin_offset as i64 - 1).max(0),
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
|| pull_result.pull_status == PullStatus::NoMatchedMsg | |
{ | |
if !self.should_run_pop_revive { | |
return None; | |
} | |
self.consumer_offset_manager.commit_offset( | |
CheetahString::from_static_str(PopAckConstants::LOCAL_HOST), | |
&CheetahString::from_static_str(PopAckConstants::REVIVE_GROUP), | |
&self.revive_topic, | |
queue_id, | |
pull_result.next_begin_offset as i64 - 1, | |
); | |
} | |
|| pull_result.pull_status == PullStatus::NoMatchedMsg | |
{ | |
if !self.should_run_pop_revive { | |
return None; | |
} | |
self.consumer_offset_manager.commit_offset( | |
CheetahString::from_static_str(PopAckConstants::LOCAL_HOST), | |
&CheetahString::from_static_str(PopAckConstants::REVIVE_GROUP), | |
&self.revive_topic, | |
queue_id, | |
(pull_result.next_begin_offset as i64 - 1).max(0), | |
); | |
} |
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 #2075
Brief Description
How Did You Test This Change?
Summary by CodeRabbit