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

   ### Before Creating the Bug Report
   
   - [X] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq/discussions).
   
   - [X] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq/discussions)  of this 
repository and believe that this is not a duplicate.
   
   - [X] I have confirmed that this bug belongs to the current repository, not 
other repositories of RocketMQ.
   
   
   ### Runtime platform environment
   
   CentOS 7.3
   
   ### RocketMQ version
   
   4.8.x upgrade to 4.9.x
   
   ### JDK Version
   
   OpenJDK 1.8.0_202
   
   ### Describe the Bug
   
   During the process of broker upgrade, the consumer will get the consume 
offset from the broker when client rebalance occurs. When the RocketMQ broker 
version is upgraded from 4.8.x to 4.9.x and the LMQ function is enabled. The 
broker will only initialize the LmqConsumerOffsetManager as follows:
   ```this.consumerOffsetManager = messageStoreConfig.isEnableLmq() ? new 
LmqConsumerOffsetManager(this) : new ConsumerOffsetManager(this);```
   
![0da1dc62-ebb6-4ef6-a69d-bd98a747c403](https://github.com/apache/rocketmq/assets/50660789/b57778ba-8600-4181-b41f-ed7720dbefe8)
   And the persistent file name of LmqConsumerOffsetManager is 
**lmqConsumerOffset.json**, which is different from the original consume offset 
file name **consumerOffset.json**. For the above reasons, the new version 
LmqConsumerOffsetManager cannot load the previous consume offset when the 
broker restarts. The broker side will return consumption point 0 to the client. 
As follows:
   
![image](https://github.com/apache/rocketmq/assets/50660789/5c794450-9f91-4ee7-a07b-d002a6fad587)
   Based on the above logic, when the consume offset is 0 at the consumer side, 
which is less than the minimum consume offset, it will start to pull from the 
minimum offset. Lead to consumption accumulation and consumption duplication.
   
![image](https://github.com/apache/rocketmq/assets/50660789/9c3ed1f5-3079-4aae-a5d2-5b6babaeadd1)
   
   
   ### Steps to Reproduce
   
   1. Broker version less than 4.9.3.
   2. There's topics who's min offset is bigger than 0.
   3. Broker version upgrade to version 4.9.3+ 
   
   ### What Did You Expect to See?
   
   Consumer offset should not be reset to minimum.
   
   ### What Did You See Instead?
   
   Consumer offset was reset to minimum.
   
   ### Additional Context
   
   _No response_


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