You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "chenxu80 (via GitHub)" <gi...@apache.org> on 2026/06/02 09:05:14 UTC
[I] [Bug] Stale minOffset after truncating all ConsumeQueue files [rocketmq]
chenxu80 opened a new issue, #10417:
URL: https://github.com/apache/rocketmq/issues/10417
### 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
ubuntu 24.04
### RocketMQ version
rocketmq-all-5.5.0
### JDK Version
JDK 8u202
### Describe the Bug
When broker-side commitlog truncation removes all ConsumeQueue files for a topic queue, the queue may retain a stale minOffset instead of resetting it to 0, leaving an inconsistent state where minOffset > maxOffset (with maxOffset == 0).
### Steps to Reproduce
- Enable Jraft controller mode
- Make a broker-slave offline
- Produce some messages to a never-used topic queue on broker-master
- Make the master offline
- Make the slave online and let controller choose it as new master(if the slave was out of ISR, enable electUncleanMaster)
- Produce more messages to the topic queue mentioned above
### What Did You Expect to See?
Messages produced to the topic queue can be consumed
### What Did You See Instead?
Messages produced to the topic queue cannot be consumed until enough messages had been written into the queue(which will make the stale minOffset effective again)
### Additional Context
This problem is caused by method:
org.apache.rocketmq.store.ConsumeQueue#correctMinOffset
when 'minLogicOffset >= mappedFileQueue.getMaxOffset()' is satisfied, this method did nothing and just return
--
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: commits-unsubscribe@rocketmq.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Stale minOffset after truncating all ConsumeQueue files [rocketmq]
Posted by "oss-taishan-ai (via GitHub)" <gi...@apache.org>.
oss-taishan-ai commented on issue #10417:
URL: https://github.com/apache/rocketmq/issues/10417#issuecomment-4619945305
**Issue Evaluation**
Category: `type/bug` | Status: **Confirmed**
The reported issue has been verified against the current codebase.
**Root Cause:** In `ConsumeQueue#correctMinOffset`, when commitlog truncation deletes all ConsumeQueue files for a topic queue, `mappedFileQueue.getMaxOffset()` returns 0 but `minLogicOffset` retains its stale value. The original code path:
1. Checks `minLogicOffset >= mappedFileQueue.getMaxOffset()` → true (stale value > 0, max == 0)
2. Logs "contains no valid entries" and returns **without resetting `minLogicOffset`**
3. Result: `minOffset > maxOffset` (e.g., minOffset=stale, maxOffset=0) — invalid state
Consumers calling `getMinOffsetInQueue()` get a stale value that is larger than the queue's actual max offset, making the newly produced messages unconsumable until enough messages accumulate to push the offset past the stale `minLogicOffset`.
**Impact:** Consumer availability — messages produced after a failover scenario become temporarily unconsumable in the affected queue.
**Severity:** High — affects message consumption in DLedger/JRaft controller failover scenarios.
**Reproduction path verified:** The described steps (slave offline → master produces → master offline → slave becomes new master → produces) trigger commitlog truncation on the new master that deletes all CQ files, exposing this bug.
PR #10418 provides the correct fix: when all mapped files are gone (`getLastMappedFile() == null`), reset `minLogicOffset` to 0 and `maxPhysicOffset` to -1, restoring the queue to its initial empty state.
---
*Automated evaluation by github-manager-bot*
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Stale minOffset after truncating all ConsumeQueue files [rocketmq]
Posted by "RongtongJin (via GitHub)" <gi...@apache.org>.
RongtongJin closed issue #10417: [Bug] Stale minOffset after truncating all ConsumeQueue files
URL: https://github.com/apache/rocketmq/issues/10417
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org