qianye1001 opened a new pull request, #10954: URL: https://github.com/apache/rocketmq/pull/10954
### Which Issue(s) This PR Fixes - Fixes #10953 ### Brief Description `DefaultMessageStore.estimateMessageCount` shifts a filtered estimation range to the ConsumeQueue minimum offset when the requested lower bound has expired. The shifted upper bound was not constrained by the current maximum offset, so the range could extend beyond readable ConsumeQueue data. File-based ConsumeQueue scans could then emit `selectMappedBuffer request pos invalid` warnings and report a zero estimate without examining any entries. This change: - preserves the existing right-shift behavior and the requested interval length when space is available; - clamps both shifted endpoints to the current ConsumeQueue bounds; - truncates the shifted upper bound at `maxOffset` without overflowing; - returns zero when clamping produces an empty range. Regression tests cover a shifted range truncated at the maximum offset, a shifted range that preserves its full length, and a range that starts after the maximum offset. ### How Did You Test This Change? Ran with Amazon Corretto JDK 11: ```bash mvn -pl store "-Dtest=DefaultMessageStoreTest#testEstimateMessageCountShiftsRangeWithinQueueBounds+testEstimateMessageCountPreservesLengthWhenShiftedRangeFits+testEstimateMessageCountReturnsZeroWhenRangeIsAfterMaxOffset" test ``` Result: 3 tests run, 0 failures, 0 errors, 0 skipped. The same Maven run also completed Checkstyle and SpotBugs with no violations or findings. -- 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]
