Skip to content

Conversation

@guyinyou
Copy link
Contributor

  • Add snapshot backup and recovery functionality to TimerWheel
  • Add configuration options for snapshot control with backward compatibility
  • Implement atomic flush operations with synchronization locks
  • Add snapshot file management (creation, cleanup, selection)
  • Support recovery from snapshot files to avoid rebuilding TimerWheel
  • Add TimerFlushService.flush() method for manual flush operations

This addresses the issue where discrete TimerWheel state cannot be recovered from TimerLog alone, ensuring data consistency and improving recovery performance.

Configuration changes:

  • timerWheelSnapshotFlush: enable/disable snapshot functionality (default: false)
  • timerWheelDefaultFlush: enable/disable default flush behavior (default: true)
  • timerWheelSnapshotIntervalMs: snapshot creation interval (default: 10s)

Change-Id: I801ce7ca6330d02aefcae905e59e1e2b7642ebf5

Which Issue(s) This PR Fixes

Fixes #9735

Brief Description

How Did You Test This Change?

@codecov-commenter
Copy link

codecov-commenter commented Sep 25, 2025

Codecov Report

❌ Patch coverage is 33.96226% with 105 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.21%. Comparing base (1c83b11) to head (29f2234).
⚠️ Report is 10 commits behind head on develop.

Files with missing lines Patch % Lines
...va/org/apache/rocketmq/store/timer/TimerWheel.java 17.39% 52 Missing and 5 partials ⚠️
...apache/rocketmq/store/timer/TimerMessageStore.java 35.29% 28 Missing and 5 partials ⚠️
...ache/rocketmq/store/logfile/DefaultMappedFile.java 62.96% 6 Missing and 4 partials ⚠️
...ache/rocketmq/store/config/MessageStoreConfig.java 37.50% 5 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #9736      +/-   ##
=============================================
- Coverage      48.36%   48.21%   -0.16%     
+ Complexity     12204    12178      -26     
=============================================
  Files           1313     1313              
  Lines          93340    93440     +100     
  Branches       11962    11982      +20     
=============================================
- Hits           45148    45051      -97     
- Misses         42627    42802     +175     
- Partials        5565     5587      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@guyinyou guyinyou force-pushed the dev_fix_timer_wheel_for_develop_000 branch from 908f5ae to bcd8268 Compare September 25, 2025 11:46
@RongtongJin RongtongJin added the ha label Sep 26, 2025
@guyinyou guyinyou force-pushed the dev_fix_timer_wheel_for_develop_000 branch from c4a54dd to a2a3fe3 Compare October 9, 2025 02:14
RongtongJin
RongtongJin previously approved these changes Oct 14, 2025
guyinyou and others added 9 commits October 24, 2025 09:58
- Add snapshot backup and recovery functionality to TimerWheel
- Add configuration options for snapshot control with backward compatibility
- Implement atomic flush operations with synchronization locks
- Add snapshot file management (creation, cleanup, selection)
- Support recovery from snapshot files to avoid rebuilding TimerWheel
- Add TimerFlushService.flush() method for manual flush operations

This addresses the issue where discrete TimerWheel state cannot be
recovered from TimerLog alone, ensuring data consistency and
improving recovery performance.

Configuration changes:
- timerWheelSnapshotFlush: enable/disable snapshot functionality (default: false)
- timerWheelDefaultFlush: enable/disable default flush behavior (default: true)
- timerWheelSnapshotIntervalMs: snapshot creation interval (default: 10s)

Change-Id: I801ce7ca6330d02aefcae905e59e1e2b7642ebf5
fix
Change-Id: I97968a6b87d55c73ce871b3522c67b8b543d6eb2
fix
Change-Id: Id751e63ddd20ca6223d83d8057623f19e54fa3ca
fix
Change-Id: I8099c89ebded4f5b66eb98537396afc75b147583
fix
Change-Id: I1610f1ebba7b05de8517111155f2116025c65e1e
fix
Change-Id: Iad1171bf7805102f0a87b9623de048fc8bbe9fce
fix
Change-Id: Ic1ef006f709006a0f30c734cb4426d3aea57eccd
Change-Id: I1c7c2895efebfef0185411c0630bbd2da23ce3c7
fix
Change-Id: I73e9ecd37f25bda6d6d2f5191bd11ebb8d02c39e
@guyinyou guyinyou force-pushed the dev_fix_timer_wheel_for_develop_000 branch from 23e30a1 to 98f73e1 Compare October 24, 2025 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Add TimerWheel snapshot mechanism for reliable recovery

3 participants