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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
