[ 
https://issues.apache.org/jira/browse/ROCKETMQ-239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16178501#comment-16178501
 ] 

ASF GitHub Bot commented on ROCKETMQ-239:
-----------------------------------------

Github user dongeforever commented on a diff in the pull request:

    https://github.com/apache/incubator-rocketmq/pull/129#discussion_r140684767
  
    --- Diff: store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java 
---
    @@ -151,7 +151,7 @@ public void recover() {
             }
         }
     
    -    public long getOffsetInQueueByTime(final long timestamp) {
    +    public long getOffsetInQueueByTime(final long timestamp, boolean 
isGetTimeLast) {
             MappedFile mappedFile = 
this.mappedFileQueue.getMappedFileByTime(timestamp);
    --- End diff --
    
    It is not reliable to get mapped file by modification time, as if the 
dispatch service fall behind too much, it may get the wrong mapped file.
    How about checking each file's first message and last message it pointed to?
    This may cause performance loss, but it is acceptable, for such api is used 
only for some specific diagnoses. It is rarely used, but when using it, it'd 
better to return the exactly correct result. 


> Query message by time and get queue offset by time return is always less than 
> want. 
> ------------------------------------------------------------------------------------
>
>                 Key: ROCKETMQ-239
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-239
>             Project: Apache RocketMQ
>          Issue Type: Bug
>          Components: rocketmq-store
>    Affects Versions: 4.1.0-incubating
>            Reporter: lindzh
>            Assignee: yukon
>             Fix For: 4.2.0-incubating
>
>
> When using queryMessageByTime or searchOffsetByTime or resetOffsetByTime , 
> DefaultMessageStore return offset is not so accurate as we want.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to