Skip to content

Commit

Permalink
db: don't ignore range key bounds during excise
Browse files Browse the repository at this point in the history
  • Loading branch information
bananabrick committed Sep 26, 2023
1 parent 6604500 commit 1d30adc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,8 @@ func (d *DB) excise(
smallestPointKey.UserKey = firstRangeDel
rightFile.ExtendPointKeyBounds(d.cmp, smallestPointKey, largestPointKey)
}
} else if m.HasRangeKeys && !exciseSpan.Contains(d.cmp, m.LargestRangeKey) {
}
if m.HasRangeKeys && !exciseSpan.Contains(d.cmp, m.LargestRangeKey) {
// This file will contain range keys.
largestRangeKey := m.LargestRangeKey
if rangeKeyIter == nil {
Expand Down
1 change: 1 addition & 0 deletions ingest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ func TestExcise(t *testing.T) {
flushed = true
}},
FormatMajorVersion: FormatVirtualSSTables,
Comparer: testkeys.Comparer,
}
// Disable automatic compactions because otherwise we'll race with
// delete-only compactions triggered by ingesting range tombstones.
Expand Down
34 changes: 34 additions & 0 deletions testdata/excise
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,37 @@ would excise 2 files, use ingest-and-excise to excise.
added: L0 000009:[b#11,SET-b#11,SET] seqnums:[11-11] points:[b#11,SET-b#11,SET]
added: L0 000010:[g#11,RANGEDEL-i#inf,RANGEDEL] seqnums:[11-11] points:[g#11,RANGEDEL-i#inf,RANGEDEL]
added: L6 000011:[d#10,RANGEKEYSET-f#inf,RANGEKEYSET] seqnums:[10-10] ranges:[d#10,RANGEKEYSET-f#inf,RANGEKEYSET]

reset
----

# Create an sstable with a range key set.
batch
set a a
set b b
set d d
range-key-set e ee @1 foo
----

flush
----

lsm
----
0.0:
000005:[a#10,SET-ee#inf,RANGEKEYSET]

build ext2
set z z
----

ingest-and-excise ext2 excise=b-c
----

lsm
----
0.0:
000007:[a#10,SET-a#10,SET]
000008:[d#12,SET-ee#inf,RANGEKEYSET]
6:
000006:[z#14,SET-z#14,SET]

0 comments on commit 1d30adc

Please sign in to comment.