From 44153fd9c9021adb4567bda87e818838e45fa5dc Mon Sep 17 00:00:00 2001 From: duhenglucky Date: Mon, 16 Sep 2019 10:15:26 +0800 Subject: [PATCH] Fix the slave abnormal recover slow issue --- .../src/main/java/org/apache/rocketmq/store/ConsumeQueue.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java b/store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java index a63d3746..86e735bf 100644 --- a/store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java +++ b/store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.rocketmq.common.constant.LoggerName; import org.apache.rocketmq.logging.InternalLogger; import org.apache.rocketmq.logging.InternalLoggerFactory; +import org.apache.rocketmq.store.config.BrokerRole; import org.apache.rocketmq.store.config.StorePathConfigHelper; public class ConsumeQueue { @@ -397,6 +398,9 @@ public class ConsumeQueue { boolean result = this.putMessagePositionInfo(request.getCommitLogOffset(), request.getMsgSize(), tagsCode, request.getConsumeQueueOffset()); if (result) { + if (this.defaultMessageStore.getMessageStoreConfig().getBrokerRole() == BrokerRole.SLAVE) { + this.defaultMessageStore.getStoreCheckpoint().setPhysicMsgTimestamp(request.getStoreTimestamp()); + } this.defaultMessageStore.getStoreCheckpoint().setLogicsMsgTimestamp(request.getStoreTimestamp()); return; } else { -- GitLab