-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[ISSUE #2249]🚀AckMessageProcessor and BrokerStatsManager add shutdown method #2250
Conversation
WalkthroughThis pull request adds a Changes
Assessment against linked issues
Possibly related PRs
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 #2250 +/- ##
==========================================
- Coverage 28.31% 28.30% -0.01%
==========================================
Files 499 499
Lines 72187 72193 +6
==========================================
Hits 20437 20437
- Misses 51750 51756 +6 ☔ 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: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
rocketmq-broker/src/processor/ack_message_processor.rs
(2 hunks)rocketmq-store/src/stats/broker_stats_manager.rs
(2 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: test
- GitHub Check: build (ubuntu-latest, nightly)
- GitHub Check: build
- GitHub Check: build (ubuntu-latest, stable)
- GitHub Check: auto-approve
🔇 Additional comments (2)
rocketmq-store/src/stats/broker_stats_manager.rs (1)
33-33
: LGTM!The import is correctly placed and used by the new
shutdown
method.rocketmq-broker/src/processor/ack_message_processor.rs (1)
49-49
: LGTM!The import is correctly placed and used by the new
shutdown
method.
pub fn shutdown(&self) { | ||
warn!("BrokerStatsManager shutdown unimplemented"); | ||
} |
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.
Implement proper cleanup in the shutdown method.
The current implementation is a placeholder that only logs a warning. Consider implementing proper cleanup:
- Clear stats tables to prevent memory leaks
- Flush any pending stats to storage
- Stop any background tasks or scheduled printers
- Clean up any shared resources
Here's a suggested implementation:
pub fn shutdown(&self) {
- warn!("BrokerStatsManager shutdown unimplemented");
+ // Clear stats tables
+ self.stats_table.write().clear();
+
+ // Stop scheduled printers
+ if let Some(broker_config) = &self.broker_config {
+ // Cleanup tasks specific to broker config
+ }
+
+ // Clear moment stats
+ if let Some(stats) = &self.moment_stats_item_set_fall_size {
+ // Cleanup moment stats
+ }
+ if let Some(stats) = &self.moment_stats_item_set_fall_time {
+ // Cleanup moment stats
+ }
+
+ // Shutdown account stat manager
+ self.account_stat_manager.shutdown();
+
+ info!("BrokerStatsManager shutdown completed");
}
Committable suggestion skipped: line range outside the PR's diff.
pub fn shutdown(&mut self) { | ||
warn!("AckMessageProcessor shutdown unimplemented, need to be implemented"); | ||
} |
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.
Implement proper cleanup in the shutdown method.
The current implementation is a placeholder that only logs a warning. Consider implementing proper cleanup:
- Wait for pending acks to complete
- Handle in-flight messages
- Clean up resources in the pop message processor
- Ensure message delivery guarantees are maintained
Here's a suggested implementation:
pub fn shutdown(&mut self) {
- warn!("AckMessageProcessor shutdown unimplemented, need to be implemented");
+ // Wait for pending acks to complete
+ // TODO: Add timeout to prevent infinite wait
+ while self.has_pending_acks() {
+ tokio::time::sleep(Duration::from_millis(100)).await;
+ }
+
+ // Clean up pop message processor
+ self.pop_message_processor.shutdown().await;
+
+ // Clean up broker runtime
+ self.broker_runtime_inner.shutdown().await;
+
+ info!("AckMessageProcessor shutdown completed");
}
+
+fn has_pending_acks(&self) -> bool {
+ // Implement check for pending acks
+ false
+}
Committable suggestion skipped: line range outside the PR's diff.
Which Issue(s) This PR Fixes(Closes)
Fixes #2249
Brief Description
How Did You Test This Change?
Summary by CodeRabbit
shutdown
methods toAckMessageProcessor
andBrokerStatsManager
with warning logs