Wubabalala opened a new pull request, #10236:
URL: https://github.com/apache/rocketmq/pull/10236

   ### Which Issue(s) This PR Fixes
   
   - Fixes #10193
   
   ### Brief Description
   
   `TieredMessageStore.getMinOffsetInQueue()` merges the min offset from the 
next store and tiered store using `Math.min()`. However, when the next store 
has no valid data, it returns -1 as a sentinel value. This -1 is not a real 
offset but still participates in the `Math.min(-1, tieredOffset)` comparison, 
which always returns -1 and silently discards a valid tiered store offset.
   
   The fix adds a guard for `minOffsetInNextStore < 0` before the `Math.min` 
call, mirroring the existing `minOffsetInTieredStore < 0` guard above it. When 
the next store is invalid, the tiered store offset is returned directly.
   
   ### How Did You Test This Change?
   
   Added a test case in `TieredMessageStoreTest.testGetMinOffsetInQueue()`: set 
the next store to return -1 while the tiered store holds a valid offset, and 
verify the tiered offset is returned instead of -1. All 111 tieredstore module 
tests pass.


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