RongtongJin opened a new pull request, #9700:
URL: https://github.com/apache/rocketmq/pull/9700

   <!-- Please make sure the target branch is right. In most case, the target 
branch should be `develop`. -->
   
   ### Which Issue(s) This PR Fixes
   
   <!-- Please ensure that the related issue has already been created, and 
[link this pull request to that issue using 
keywords](<https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword>)
 to ensure automatic closure. -->
   
   Fixes #9699
   
   This PR optimizes the shutdown process and resource management across 
multiple RocketMQ components to ensure graceful shutdown and prevent resource 
leaks.
   
   ### Brief Description
   
   <!-- Write a brief description for your pull request to help the maintainer 
understand the reasons behind your changes. -->
   
   **Key Improvements:**
   
   1. **Enhanced BrokerController Shutdown Sequence**
      - Improved shutdown order for all broker services
      - Added proper termination for transactional message services
      - Enhanced cleanup of notification processors and offset managers
   
   2. **Storage Layer Optimizations**
      - **DefaultMessageStore**: Enhanced shutdown flow with proper state 
management
      - **CommitLog**: Improved resource cleanup during shutdown
      - **MappedFileQueue**: Added proper shutdown handling
      - **StoreCheckpoint**: Enhanced checkpoint shutdown process
      - **DefaultHAService**: Improved HA service shutdown
   
   3. **Timer Component Enhancements**
      - **TimerMessageStore**: Comprehensive shutdown improvements with proper 
resource cleanup
      - **TimerCheckpoint**: Enhanced checkpoint shutdown process
      - **TimerLog**: Improved log shutdown handling
      - **TimerWheel**: Better wheel shutdown management
   
   4. **Processor Improvements**
      - **AckMessageProcessor**: Added proper shutdown handling
      - **NotificationProcessor**: Enhanced shutdown process
      - **PopMessageProcessor**: Improved shutdown sequence
      - **PopBufferMergeService**: Better resource cleanup
   
   5. **Common Components**
      - **AbstractRocksDBStorage**: Enhanced RocksDB shutdown process
      - **StatisticsManager**: Improved statistics cleanup
      - **ClientHousekeepingService**: Better client cleanup
   
   **Impact:**
   - Prevents resource leaks during broker shutdown
   - Ensures graceful termination of all components
   - Improves system stability and reliability
   - Fixes test failures related to improper shutdown handling
   
   ### How Did You Test This Change?
   
   <!-- In order to ensure the code quality of Apache RocketMQ, we expect every 
pull request to have undergone thorough testing. -->
   
   **Manual Testing Scenarios:**
   - Broker startup and shutdown cycles
   - Resource cleanup verification
   - State management validation
   - Error handling verification
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to