cdmaji opened a new pull request, #5456:
URL: https://github.com/apache/rocketmq/pull/5456

   What is the purpose of the change
   使用resetOffsetByTime重置位置点的时候,如果遇到batch消息,会导致目标位置点不准确的问题。JIRA:
   https://github.com/apache/rocketmq/issues/5445
   
   Brief change log
   
   - 二分算法后增加向左移动匹配逻辑
   
   Verifying this change
   验证数据构造数据,我构造了两个Topic模拟两种场景进行测试:
   
   1. 创建Topic-A,2Queue,先使用send(Collection<Message> 
msgs)方法发送20条消息,此时Queue-0中LogSize为20;然后调用send(Message msg) 
再次发送20条消息,此时Queue-0中LogZise为30,Queue-1中LogSize为10;启动Consumer进行消费,确保消费完成后停掉Consumer;idea中Run
 MQAdminStartup添加参数:resetOffsetByTime -t rktn_maji_offsetreset_2_test_mid-rd -g 
group_dmg_sdk_example-rktn_maji_offsetreset_2_test_mid-rd -n 127.0.0.1:9876 -s 
1667381526899;1667381526899为20条批量消息的时间戳。执行结果:
   
   
![image](https://user-images.githubusercontent.com/13196820/199482852-9ec8757f-1b42-4d16-83f8-8d1c88998234.png)
   
   2. 创建Topic-B,2Queue,先调用send(Message msg) 
再次发送20条消息,此时Queue-0中LogZise为10,Queue-1中LogSize为10;然后调用send(Collection<Message> 
msgs)方法发送20条消息,此时Queue-0中LogZise为30,Queue-1中LogSize为10;启动Consumer进行消费,确保消费完成后停掉Consumer;idea中Run
 MQAdminStartup添加参数:resetOffsetByTime -t rktn_maji_offsetreset_test_mid-rd -g 
group_dmg_sdk_example-rktn_maji_offsetreset_test_mid-rd -n 127.0.0.1:9876 -s 
1667372951222;1667372951222为20条批量消息的时间戳。执行结果:
   
   
![image](https://user-images.githubusercontent.com/13196820/199483646-724d65cb-4bb6-4b18-9a38-249fc5b2326c.png)
   这种情况下Queue-1实际因为消息中没有比这条消息更新的消息所以返回-1导致重置到位置9(此问题单独解决)。
   
   Other issues
   
resetOffsetByTime命令没有提供指定Queue,导致resetOffsetByTime方法在某些场景中却在不足,导致所有队列一起重置。最好能提供一个可选参数可以执行QueueId。
   
   


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