Ajax-1 opened a new pull request, #11499:
URL: https://github.com/apache/rocketmq/pull/11499

   ### Which Issue(s) This PR Fixes
   
   - Fixes #11498
   
   ### Brief Description
   
   `TimerWheel.checkPhyPos(readTimeMs, 0)` returns `Long.MAX_VALUE` when no 
eligible slot exists in the timer wheel. 
`TimerMessageStore.checkAndReviseMetrics()` passed that sentinel straight to 
`timerLog.getWholeBuffer(...)`, so `MappedFileQueue.findMappedFileByOffset` 
logged a misleading `Offset not matched. Request offset: 9223372036854775807 
...` warning whenever a TimerLog mapped file existed.
   
   This PR makes the scan loop skip the sentinel (`while (currOffsetPy != 
Long.MAX_VALUE)`) instead of returning early, so the subsequent metrics 
revision still runs and small-topic counts are still reconciled (e.g. revised 
to 0 when the wheel is empty). Behavior for valid offsets is unchanged.
   
   ### How Did You Test This Change?
   
   Added two tests in `TimerMessageStoreTest`:
   
   - `testCheckAndReviseMetricsWithEmptyTimerWheel`: TimerLog has an allocated 
mapped file and the wheel has no eligible slot; verifies 
`getWholeBuffer(Long.MAX_VALUE)` is never called and a stale metric (5) is 
revised to 0. This test fails without the fix.
   - `testCheckAndReviseMetricsWithValidSlot`: enqueues two timer records into 
a valid slot; verifies the scan still works and a stale metric (5) is revised 
to 2.
   
   Ran `mvn -pl store test 
-Dtest='TimerMessageStoreTest,TimerWheelTest,TimerMetricsTest'` locally: all 
passed (one pre-existing test is skipped on macOS by `Assume`), checkstyle 
passed.
   


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