-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
internal/rangekey: fix defragmentation of unsets/dels with ScanInternal #3058
Comments
itsbilal
added a commit
to itsbilal/pebble
that referenced
this issue
Nov 14, 2023
This change moves the `scanInternalIterator` away from using a UserIteratorConfig to coalesce range keys, and towards something that's more in-line with rangeKeyCompactionTransform i.e. just calling rangekey.Coalesce() on the relevant slice of range keys if any. This preserves expected defragmenting behaviour for cases where we have abutting range keys that are identical in everything except kinds. Fixes cockroachdb#3058.
itsbilal
added a commit
to itsbilal/pebble
that referenced
this issue
Nov 15, 2023
This change moves the `scanInternalIterator` away from using a UserIteratorConfig to coalesce range keys, and towards something that's more in-line with rangeKeyCompactionTransform i.e. just calling rangekey.Coalesce() on the relevant slice of range keys if any. This preserves expected defragmenting behaviour for cases where we have abutting range keys that are identical in everything except kinds. Fixes cockroachdb#3058.
itsbilal
added a commit
to itsbilal/pebble
that referenced
this issue
Nov 16, 2023
This change moves the `scanInternalIterator` away from using a UserIteratorConfig to coalesce range keys, and towards something that's more in-line with rangeKeyCompactionTransform i.e. just calling rangekey.Coalesce() on the relevant slice of range keys if any. This preserves expected defragmenting behaviour for cases where we have abutting range keys that are identical in everything except kinds. Fixes cockroachdb#3058.
itsbilal
added a commit
to itsbilal/pebble
that referenced
this issue
Nov 16, 2023
This change moves the `scanInternalIterator` away from using a UserIteratorConfig to coalesce range keys, and towards something that's more in-line with rangeKeyCompactionTransform i.e. just calling rangekey.Coalesce() on the relevant slice of range keys if any. This preserves expected defragmenting behaviour for cases where we have abutting range keys that are identical in everything except kinds. Fixes cockroachdb#3058.
This was referenced Nov 22, 2023
pav-kv
pushed a commit
to pav-kv/pebble
that referenced
this issue
Nov 28, 2023
This change moves the `scanInternalIterator` use case of UserIteratorConfig over to something that's closer to rangeKeyCompactionTransform, where internal keys are coalesced using rangekey.coalesce, key order is maintained at ByTrailerDesc, and defragmentation happens by internal key using keyspan.DefragmentInternal. The onlySets var is renamed to internalKeys and its meaning is reversed. Fixes cockroachdb#3058.
RaduBerinde
pushed a commit
to RaduBerinde/pebble
that referenced
this issue
Nov 30, 2023
This change moves the `scanInternalIterator` use case of UserIteratorConfig over to something that's closer to rangeKeyCompactionTransform, where internal keys are coalesced using rangekey.coalesce, key order is maintained at ByTrailerDesc, and defragmentation happens by internal key using keyspan.DefragmentInternal. The onlySets var is renamed to internalKeys and its meaning is reversed. Fixes cockroachdb#3058.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, ScanInternal creates a
UserIteratorConfig
for range keys withonlySets
set to false to also surface range key unsets/dels. However, the coalescing / defragmentation logic there is flawed, and crucially does not check for key kinds, only suffixes and values. A set (of an empty value) followed by an adjoining unset for the same suffix would get defragmented, losing information from the kind of one of those two spans.To fix this, a variant of UserIteratorConfig could be used that correctly defragments all key kinds, similar to compactions, instead of relying on
onlySets=false
.See comment in #3054 (review) for context and details.
The text was updated successfully, but these errors were encountered: