[ISSUE #10193] Fix incorrect min offset when next store returns -1#10236
Closed
Wubabalala wants to merge 1 commit intoapache:developfrom
Closed
[ISSUE #10193] Fix incorrect min offset when next store returns -1#10236Wubabalala wants to merge 1 commit intoapache:developfrom
Wubabalala wants to merge 1 commit intoapache:developfrom
Conversation
…s -1 When the local store has no valid min offset and returns -1 as a sentinel value, TieredMessageStore.getMinOffsetInQueue() incorrectly returns -1 via Math.min(-1, tieredOffset), ignoring a valid tiered store offset. Add a guard for minOffsetInNextStore < 0 before the Math.min comparison, returning the tiered store offset directly when the local store has no valid data. Add test case covering local=-1 with valid tiered offset.
3 tasks
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Issue(s) This PR Fixes
Brief Description
TieredMessageStore.getMinOffsetInQueue()merges the min offset from the next store and tiered store usingMath.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 theMath.min(-1, tieredOffset)comparison, which always returns -1 and silently discards a valid tiered store offset.The fix adds a guard for
minOffsetInNextStore < 0before theMath.mincall, mirroring the existingminOffsetInTieredStore < 0guard 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.