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

   ### 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
   
   Windows 11
   
   ### RocketMQ version
   
   branch: 4.9.x
   
   ### JDK Version
   
   jdk8
   
   ### Describe the Bug
   
   ConsumeQueue minOffset did not update when the corresponding CommitLog files 
were all deleted.
   
   ### Steps to Reproduce
   
   1. Set mappedFileSizeCommitLog to 102400.
   2. Create 3 topics: TopicTest1 TopicTest2 TopicTest3.
   3. Produce 1000 messages to each topic in sequence.
   4. Now we may have 6 CommitLog files, use the RocketMQ admin client to 
delete the first 5 of them.
   5. Use TopicStatus admin command to retrieve TopicTest1's status.
   
   ### What Did You Expect to See?
   
   TopicTest1's info should be like this:
   
   ```log
   #Broker Name                      #QID  #Min Offset           #Max Offset    
         #Last Updated
   broker-a                          0     250                   250            
         
   broker-a                          1     250                   250            
         
   broker-a                          2     250                   250            
         
   broker-a                          3     250                   250            
         
   ```
   
   Because all the CommitLog files for this topic have been deleted, the min 
offset should equal the max offset.
   
   ### What Did You See Instead?
   
   ```log
   #Broker Name                      #QID  #Min Offset           #Max Offset    
         #Last Updated
   broker-a                          0     0                   250              
       
   broker-a                          1     0                   250              
       
   broker-a                          2     0                   250              
       
   broker-a                          3     0                   250              
       
   ```
   
   The min offset is not updated.
   
   ### Additional Context
   
   This is because when correcting the min offset of consume queues, we scan 
its last file linearly, and if all consume queue items' physical offset is 
smaller than the current min physical offset, the min offset of the consume 
queue won't be updated.
   
   
https://github.com/apache/rocketmq/blob/11e049ca1448609cc6c733e323a060af573438e6/store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java#L343-L378
   
   RocketMQ 5.x has fixed this problem by #4569 


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