Closed mxsm closed 2 months ago
This update optimizes the handling of topic deletion in RocketMQ by modifying the TopicRequestHandler
and DefaultMessageStore
implementations. A new delete_empty_directory
utility function is introduced, and changes are made to the BrokerConfig
and various components in the queue management system to improve efficiency and maintainability.
File/Path | Change Summary |
---|---|
rocketmq-broker/src/processor/admin_broker_processor/topic_request_handler.rs |
TopicRequestHandler 's delete_topic_in_broker now takes &mut self and simplifies topic deletion logic. |
rocketmq-common/src/common/broker/broker_config.rs |
Added auto_delete_unused_stats boolean field with a default value of false to BrokerConfig . |
rocketmq-common/src/utils/util_all.rs |
Introduced delete_empty_directory function to handle empty directory deletions with error logging. |
rocketmq-store/src/log_file.rs |
RocketMQMessageStore 's delete_topics method signature changed to take &mut self and Vec<&str> , returning i32 . |
rocketmq-store/src/message_store/default_message_store.rs |
Updated DefaultMessageStore 's delete_topics to accept Vec<&str> and include additional logic for topic deletion. |
rocketmq-store/src/queue.rs |
Added Arc import and get_consume_queue_table method to ConsumeQueueStoreTrait trait. |
rocketmq-store/src/queue/local_file_consume_queue_store.rs |
Updated Inner struct to use Arc<ConsumeQueueTable> , modified queue destruction and removal logic, and added get_consume_queue_table method. |
rocketmq-store/src/stats/broker_stats_manager.rs |
Added on_topic_deleted public function to BrokerStatsManager implementation. |
sequenceDiagram
participant Client
participant Broker
participant DefaultMessageStore
participant FileSystem
Client->>+Broker: Request delete topic
Broker->>+DefaultMessageStore: delete_topics(&mut self, Vec<&str>)
DefaultMessageStore->>FileSystem: delete topic directories
DefaultMessageStore->>Broker: Return deletion status
Broker->>-Client: Respond with status
Objective (Issue #773) | Addressed | Explanation |
---|---|---|
Optimize Topic request handle | âś… | |
Simplify method signatures and logic | âś… |
In the land where messages soar,
Topics now handled with ease, no more a chore.
Directories vanish when empty, no trace,
RocketMQ's efficiency, setting the pace.
Changes that streamline, robust and neat,
A broker’s dance, ever so sweet.
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?
🚀Thanks for your contribution🎉. CodeRabbit(AI) will review your code first🔥
Attention: Patch coverage is 0%
with 47 lines
in your changes missing coverage. Please review.
Project coverage is 26.74%. Comparing base (
5c5ed6b
) to head (aaae950
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Which Issue(s) This PR Fixes(Closes)
Fixes #773
Brief Description
How Did You Test This Change?
Summary by CodeRabbit
New Features
Improvements
delete_topics
functionality for better performance and flexibility.Bug Fixes