@@ -179,9 +179,13 @@ public TimerMessageStore(final MessageStore messageStore, final MessageStoreConf
179
179
long snapOffset = -1 ;
180
180
if (storeConfig .isTimerWheelSnapshotFlush ()) {
181
181
snapOffset = TimerWheel .getMaxSnapshotFlag (timerWheelPath );
182
- // correct recover offset
183
- timerCheckpoint .setLastTimerLogFlushPos (snapOffset );
184
- LOGGER .info ("found timerWheel snapshot offset {}" , snapOffset );
182
+ if (snapOffset > 0 ) {
183
+ // correct recover offset
184
+ timerCheckpoint .setLastTimerLogFlushPos (snapOffset );
185
+ LOGGER .info ("found timerWheel snapshot offset {}" , snapOffset );
186
+ } else {
187
+ LOGGER .info ("not found timerWheel snapshot" , snapOffset );
188
+ }
185
189
}
186
190
this .timerWheel = new TimerWheel (
187
191
timerWheelPath , this .slotsTotal , precisionMs , snapOffset );
@@ -1836,15 +1840,12 @@ public void flush() throws IOException {
1836
1840
synchronized (lockWhenFlush ) {
1837
1841
prepareTimerCheckPoint ();
1838
1842
timerLog .getMappedFileQueue ().flush (0 );
1839
- if (storeConfig .isTimerWheelDefaultFlush ()) {
1840
- timerWheel .flush ();
1843
+ if (System .currentTimeMillis () - lastSnapshotTime > storeConfig .getTimerWheelSnapshotIntervalMs ()) {
1844
+ lastSnapshotTime = System .currentTimeMillis ();
1845
+ timerWheel .backup (timerLog .getMappedFileQueue ().getFlushedWhere ());
1846
+ timerCheckpoint .flush ();
1841
1847
}
1842
1848
}
1843
- if (System .currentTimeMillis () - lastSnapshotTime > storeConfig .getTimerWheelSnapshotIntervalMs ()) {
1844
- lastSnapshotTime = System .currentTimeMillis ();
1845
- timerWheel .backup (timerLog .getMappedFileQueue ().getFlushedWhere ());
1846
- timerCheckpoint .flush ();
1847
- }
1848
1849
if (System .currentTimeMillis () - start > storeConfig .getTimerProgressLogIntervalMs ()) {
1849
1850
start = System .currentTimeMillis ();
1850
1851
long tmpQueueOffset = currQueueOffset ;
0 commit comments