sstable/colblk,cockroachkvs: fix equalPrefix in KeySeeker.SeekGE#5996
Merged
RaduBerinde merged 1 commit intocockroachdb:masterfrom Apr 24, 2026
Merged
Conversation
Both defaultKeySeeker.SeekGE (sstable/colblk) and cockroachKeySeeker.SeekGE (cockroachkvs) unconditionally returned equalPrefix=true whenever the seek key's prefix matched a row in the prefix-bytes column. The helper seekGEOnSuffix, however, may walk past the matched prefix's last row when no row in that prefix group has a suffix >= the seek suffix; in that case it returns the first row of the next prefix group (or one past maxRow). The caller mislabeled such results as having an equal prefix. This commit changes seekGEOnSuffix in both keySeekers to also return whether the resulting row still belongs to the seek key's prefix group (i.e. whether the binary search stayed strictly below the next prefix boundary), and propagates that value out of SeekGE. In existing code, this return value is only used in a specific case (synthetic suffix), where we pass a bare prefix (which cannot exercise the bug).
Member
sumeerbhola
approved these changes
Apr 24, 2026
Collaborator
sumeerbhola
left a comment
There was a problem hiding this comment.
@sumeerbhola reviewed 3 files and made 1 comment.
Reviewable status: all files reviewed (commit messages unreviewed), all discussions resolved (waiting on RaduBerinde).
Member
Author
|
TFTR! |
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.
Separating this from #5928
Both defaultKeySeeker.SeekGE (sstable/colblk) and cockroachKeySeeker.SeekGE
(cockroachkvs) unconditionally returned equalPrefix=true whenever the seek
key's prefix matched a row in the prefix-bytes column. The helper
seekGEOnSuffix, however, may walk past the matched prefix's last row when
no row in that prefix group has a suffix >= the seek suffix; in that case
it returns the first row of the next prefix group (or one past maxRow).
The caller mislabeled such results as having an equal prefix.
This commit changes seekGEOnSuffix in both keySeekers to also return
whether the resulting row still belongs to the seek key's prefix group
(i.e. whether the binary search stayed strictly below the next prefix
boundary), and propagates that value out of SeekGE.
In existing code, this return value is only used in a specific case
(synthetic suffix), where we pass a bare prefix (which cannot exercise
the bug).