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

   ### 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
   
   any
   
   ### RocketMQ version
   
   5.5.1
   
   ### JDK Version
   
   any
   
   ### Describe the Bug
   
   - The config `commitLogRecoverMaxNum` may cause message loss if dispatch 
behind is too much. In general, recovery should begin with the last file for 
which its' cq has not been fully dispatched.
   - Related code is shown below:
   ```
   public void recoverNormally(long dispatchFromPhyOffset) throws 
RocksDBException {
           boolean checkCRCOnRecover = 
this.defaultMessageStore.getMessageStoreConfig().isCheckCRCOnRecover();
           boolean checkDupInfo = 
this.defaultMessageStore.getMessageStoreConfig().isDuplicationEnable();
           int maxRecoverNum = 
this.defaultMessageStore.getMessageStoreConfig().getCommitLogRecoverMaxNum();
           if (maxRecoverNum <= 0) {
               maxRecoverNum = 10;
           }
           log.info("recoverNormally maxRecoverNum: {}", maxRecoverNum);
           final List<MappedFile> mappedFiles = 
this.mappedFileQueue.getMappedFiles();
           if (!mappedFiles.isEmpty()) {
               int index = mappedFiles.size() - 1;
               while (index > 0) {
                   MappedFile mappedFile = mappedFiles.get(index);
                   maxRecoverNum--;
                   if (isMappedFileMatchedRecover(mappedFile, true) || 
maxRecoverNum <= 0) {
                       // It's safe to recover from this mapped file
                       break;
                   }
                   index--;
               }
   ```
   
   ### Steps to Reproduce
   
   - Make dispatch behind more than `commitLogRecoverMaxNum` commitlog files by 
certain means (e.g. high pressure flow).
   - Reboot broker.
   
   ### What Did You Expect to See?
   
   - Dispatch should begin from the last undispatched message way through to 
the newest. No error log.
   
   ### What Did You See Instead?
   
   - Bug logs below can be observed, proving some messages were skipped.
   
   <img width="1591" height="363" alt="image" 
src="https://github.com/user-attachments/assets/a557085b-5653-470f-82be-589dee04fcb1";
 />
   
   ### 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