frankcrc opened a new issue, #5174:
URL: https://github.com/apache/rocketmq/issues/5174

   **BUG REPORT**
   
   1. Please describe the issue you observed:
   
   If the time of machine which deployed broker is behind that of client, more 
precisely if the time in index is less than `BornTimestamp` minus 1000, 
resending message through dashboard or mqadmin may get 
"org.apache.rocketmq.client.exception.MQClientException: CODE: 208 DESC: query 
message by key finished, but no message" error.
   
   I read source code, and found `consumeMessageDirectly` method would first 
call `viewMessage` method. In `viewMessage`, it extracts `BornTimestamp` from 
`UniqueKey`, and then use this timestamp, which is in fact `BornTimestamp` 
minus 1000 ms, to request broker.
   
   Broker then gets message offset by index, and compares the time from request 
and the time in index.
   
   I think there is a problem. The time in index is constructed by 
`indexHeader.beginTimestamp` and `timeDiff`,and `timeDiff` is calculated using 
`StoreTimestamp`, you can see it at 
`org.apache.rocketmq.store.index.IndexFile#putKey`. StoreTimestamp's unit is 
millisecond and `timeDiff`'s unit is second, which means time in index could 
discard up to 999 ms.
   
   Using the following config and data should reproduce the problem.
   
   The following is broker's config,
   
   ``` config
   brokerClusterName=testLocal
   brokerName=broker-a
   brokerId=0
   deleteWhen=04
   fileReservedTime=72
   brokerRole=SYNC_MASTER
   flushDiskType=SYNC_FLUSH
   
   namesrvAddr=127.0.0.1:9876
   brokerIP1=127.0.0.1
   brokerIP2=127.0.0.1
   
   storePathRootDir=/path/to/broker-a-m
   storePathCommitLog=/path/to/broker-a-m/commitlog
   
   mappedFileSizeCommitLog=1024*1024*1024
   
   waitTimeMillsInSendQueue=5000
   ```
   
   The following is broker-a-m's data,
   https://github.com/frankcrc/issue-attachment/blob/main/broker-a-m.tar.gz
   
   Run a consumer, which subscribes TopicTest Topic, and uses 
mdw-test-consume-group as its name.
   
   Run a dashboard, and setup namesrv addr, and open Message tab, and search 
message in TopicTest Topic between 2022-09-21 07:00 and 2022-09-22 07:00.
   
   Then you can see 3 messages.
   You can check `0AD0341A4F4418B4AAC26A30F3090000` detail, and click `RESEND 
MESSAGE`, and you should get "no messsage" error.
   You can check `0AD0341A4F0818B4AAC26A3314410000` detail, and click `RESEND 
MESSAGE`, and you should reconsume success.
   
   I think it should always success as long as i could get the message details, 
but it does not.
   
   2. Please tell us about your environment:
   
   System: UOS 
   RocketMQ version: v4.5.2
   RocketMQ dashboard: 1.0.0
   RocketMQ version of consumer client: v4.6.0
   
   3. Other information (e.g. detailed explanation, logs, related issues, 
suggestions on how to fix, etc):
   
   
   


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

To unsubscribe, e-mail: [email protected]

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

Reply via email to