Skip to content

Commit

Permalink
db: remove compactionIter's sameStripeNonSkippable
Browse files Browse the repository at this point in the history
This commit removes the compaction iterator's concept of a key that lies within
the same snapshot stripe but is non-skippable. These "non-skippable" keys lead
to bizarre behavior, such as a sequence like:

  a.MERGE.5 a.RANGEDEL.4 a.MERGE.4

yielding the separate unmerged a.MERGE.5 and a.MERGE.4 internal keys (Note
a.RANGEDEL.4 does not delete a.MERGE.4 because they share the same sequence
number.)

The sameStripeNonSkippable fell out of the fact that range deletions were
previously interleaved by the input iterator at their start key with their
sequence number. These sameStripeNonSkippable could interrupt any logic
iterating across the keys of a stripe, complicating the compaction iterator
logic. With cockroachdb#3219, range deletions began to be interleaved at their start key
with the maximal sequence number, ensuring they never interrupt the keys of a
snapshot stripe.

In some instances INVALID keys were also returned with sameStripeNonSkippable.
These keys are now treated similarly to other errors encountered during
iteration: i.err is set and newStripeNewKey is returned.

Close cockroachdb#3082.
  • Loading branch information
jbowens committed Jan 12, 2024
1 parent c20b86e commit 06fe17c
Show file tree
Hide file tree
Showing 4 changed files with 340 additions and 394 deletions.
Loading

0 comments on commit 06fe17c

Please sign in to comment.