panzhi33 commented on a change in pull request #1955:
URL: https://github.com/apache/rocketmq/pull/1955#discussion_r414593841



##########
File path: 
store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
##########
@@ -663,9 +663,27 @@ public long getMaxOffsetInQueue(String topic, int queueId) 
{
     }
 
     public long getMinOffsetInQueue(String topic, int queueId) {
+        return getMinOffsetInQueue(topic, queueId,false);
+    }
+
+    public long getMinOffsetInQueue(String topic, int queueId, boolean 
realOffset) {
         ConsumeQueue logic = this.findConsumeQueue(topic, queueId);
         if (logic != null) {
-            return logic.getMinOffsetInQueue();
+            long consumeQueueOffset = logic.getMinOffsetInQueue();
+            MessageExt msgExt = null;
+            long commitLogOffset = 0L;
+            if (realOffset) {
+                for (;consumeQueueOffset <= 
getMaxOffsetInQueue(topic,queueId);consumeQueueOffset++) {
+                    commitLogOffset = getCommitLogOffsetInQueue(topic, 
queueId, consumeQueueOffset);
+                    msgExt = lookMessageByOffset(commitLogOffset);
+                    if (null != msgExt) {
+                        return consumeQueueOffset;
+                    }
+                }
+                return consumeQueueOffset;

Review comment:
       sorry,because before we need to query the content of the dead letter 
queue message,did‘t consider this place does not need。I am modified to compare 
'this.commitLog.getMinOffset()'




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to