mirror of
https://github.com/apache/rocketmq.git
synced 2026-09-01 15:47:01 +08:00
[ISSUE #7480] Fix the offset in the timerCheckPoint will not be corrected when the commitlog and consumeQueue are truncated (#7488)
This commit is contained in:
@@ -293,6 +293,19 @@ public class TimerMessageStore {
|
||||
}
|
||||
currQueueOffset = Math.min(currQueueOffset, timerCheckpoint.getMasterTimerQueueOffset());
|
||||
|
||||
ConsumeQueueInterface cq = this.messageStore.getConsumeQueue(TIMER_TOPIC, 0);
|
||||
|
||||
// Correction based consume queue
|
||||
if (cq != null && currQueueOffset < cq.getMinOffsetInQueue()) {
|
||||
LOGGER.warn("Timer currQueueOffset:{} is smaller than minOffsetInQueue:{}",
|
||||
currQueueOffset, cq.getMinOffsetInQueue());
|
||||
currQueueOffset = cq.getMinOffsetInQueue();
|
||||
} else if (cq != null && currQueueOffset > cq.getMaxOffsetInQueue()) {
|
||||
LOGGER.warn("Timer currQueueOffset:{} is larger than maxOffsetInQueue:{}",
|
||||
currQueueOffset, cq.getMaxOffsetInQueue());
|
||||
currQueueOffset = cq.getMaxOffsetInQueue();
|
||||
}
|
||||
|
||||
//check timer wheel
|
||||
currReadTimeMs = timerCheckpoint.getLastReadTimeMs();
|
||||
long nextReadTimeMs = formatTimeMs(
|
||||
@@ -614,7 +627,7 @@ public class TimerMessageStore {
|
||||
return;
|
||||
}
|
||||
if (msg.getProperty(TIMER_ENQUEUE_MS) != null
|
||||
&& NumberUtils.toLong(msg.getProperty(TIMER_ENQUEUE_MS)) == Long.MAX_VALUE) {
|
||||
&& NumberUtils.toLong(msg.getProperty(TIMER_ENQUEUE_MS)) == Long.MAX_VALUE) {
|
||||
return;
|
||||
}
|
||||
// pass msg into addAndGet, for further more judgement extension.
|
||||
|
||||
Reference in New Issue
Block a user