build block-size=1 index-block-size=1 filter
a_xyz.SET.1:a
b_xyz.SET.1:b
c_xyz.SET.1:c
----
point:    [a_xyz#1,SET-c_xyz#1,SET]
seqnums:  [1-1]

rewrite from=xyz to=123 block-size=1 index-block-size=1 filter comparer=split-4b-suffix
----
rewrite failed: mismatched Comparer pebble.internal.testkeys vs comparer-split-4b-suffix, replacement requires same splitter to copy filters

build block-size=1 index-block-size=1 filter comparer=split-4b-suffix
aa_xyz.SET.1:a
ba_xyz.SET.1:b
ca_xyz.SET.1:c
----
point:    [aa_xyz#1,SET-ca_xyz#1,SET]
seqnums:  [1-1]

rewrite from=yz to=23 block-size=1 index-block-size=1 filter comparer=split-4b-suffix
----
rewrite failed: rewriting data blocks: key has suffix "_xyz", expected "yz"

rewrite from=a_xyz to=a_123 block-size=1 index-block-size=1 filter comparer=split-4b-suffix
----
rewrite failed: rewriting data blocks: key has suffix "_xyz", expected "a_xyz"

build block-size=1 index-block-size=1 filter comparer=split-4b-suffix
a_xyz.SET.1:a
b_xyz.SET.1:b
c_xyz.SET.1:c
----
point:    [a_xyz#1,SET-c_xyz#1,SET]
seqnums:  [1-1]

layout
----
sstable
 ├── data  offset: 0  length: 26
 ├── data  offset: 31  length: 26
 ├── data  offset: 62  length: 26
 ├── fullfilter.rocksdb.BuiltinBloomFilter  offset: 93  length: 69
 ├── index  offset: 167  length: 22
 ├── index  offset: 194  length: 22
 ├── index  offset: 221  length: 22
 ├── top-index  offset: 248  length: 48
 ├── properties  offset: 301  length: 486
 ├── meta-index  offset: 792  length: 79
 └── footer  offset: 876  length: 53

scan
----
a_xyz#1,SET:a
b_xyz#1,SET:b
c_xyz#1,SET:c

get
b_xyz
f_xyz
c_xyz
----
b
get f_xyz: pebble: not found
c

rewrite from=_xyz to=_123 block-size=1 index-block-size=1 filter comparer=split-4b-suffix
----
point:    [a_123#1,SET-c_123#1,SET]
seqnums:  [1-1]

layout
----
sstable
 ├── data  offset: 0  length: 26
 ├── data  offset: 31  length: 26
 ├── data  offset: 62  length: 26
 ├── fullfilter.rocksdb.BuiltinBloomFilter  offset: 93  length: 69
 ├── index  offset: 167  length: 22
 ├── index  offset: 194  length: 22
 ├── index  offset: 221  length: 22
 ├── top-index  offset: 248  length: 48
 ├── properties  offset: 301  length: 486
 ├── meta-index  offset: 792  length: 79
 └── footer  offset: 876  length: 53

scan
----
a_123#1,SET:a
b_123#1,SET:b
c_123#1,SET:c

get
b_123
f_123
c_123
----
b
get f_123: pebble: not found
c

rewrite from=_123 to=_456 block-size=1 index-block-size=1 filter comparer=split-4b-suffix concurrency=2
----
point:    [a_456#1,SET-c_456#1,SET]
seqnums:  [1-1]

layout
----
sstable
 ├── data  offset: 0  length: 26
 ├── data  offset: 31  length: 26
 ├── data  offset: 62  length: 26
 ├── fullfilter.rocksdb.BuiltinBloomFilter  offset: 93  length: 69
 ├── index  offset: 167  length: 22
 ├── index  offset: 194  length: 22
 ├── index  offset: 221  length: 22
 ├── top-index  offset: 248  length: 48
 ├── properties  offset: 301  length: 486
 ├── meta-index  offset: 792  length: 79
 └── footer  offset: 876  length: 53

scan
----
a_456#1,SET:a
b_456#1,SET:b
c_456#1,SET:c

get
b_456
f_456
c_456
----
b
get f_456: pebble: not found
c

rewrite from=_456 to=_xyz block-size=1 index-block-size=1 filter comparer=split-4b-suffix concurrency=3
----
point:    [a_xyz#1,SET-c_xyz#1,SET]
seqnums:  [1-1]

layout
----
sstable
 ├── data  offset: 0  length: 26
 ├── data  offset: 31  length: 26
 ├── data  offset: 62  length: 26
 ├── fullfilter.rocksdb.BuiltinBloomFilter  offset: 93  length: 69
 ├── index  offset: 167  length: 22
 ├── index  offset: 194  length: 22
 ├── index  offset: 221  length: 22
 ├── top-index  offset: 248  length: 48
 ├── properties  offset: 301  length: 486
 ├── meta-index  offset: 792  length: 79
 └── footer  offset: 876  length: 53

scan
----
a_xyz#1,SET:a
b_xyz#1,SET:b
c_xyz#1,SET:c

get
b_xyz
f_xyz
c_xyz
----
b
get f_xyz: pebble: not found
c


rewrite from=_xyz to=_123 block-size=1 index-block-size=1 filter comparer=split-4b-suffix concurrency=4
----
point:    [a_123#1,SET-c_123#1,SET]
seqnums:  [1-1]

layout
----
sstable
 ├── data  offset: 0  length: 26
 ├── data  offset: 31  length: 26
 ├── data  offset: 62  length: 26
 ├── fullfilter.rocksdb.BuiltinBloomFilter  offset: 93  length: 69
 ├── index  offset: 167  length: 22
 ├── index  offset: 194  length: 22
 ├── index  offset: 221  length: 22
 ├── top-index  offset: 248  length: 48
 ├── properties  offset: 301  length: 486
 ├── meta-index  offset: 792  length: 79
 └── footer  offset: 876  length: 53

scan
----
a_123#1,SET:a
b_123#1,SET:b
c_123#1,SET:c

get
b_123
f_123
c_123
----
b
get f_123: pebble: not found
c

# Rewrite a table that contain only range keys.

build block-size=1 index-block-size=1 filter comparer=split-4b-suffix
Span: a-b:{(#1,RANGEKEYSET,_xyz)}
Span: b-c:{(#1,RANGEKEYSET,_xyz)}
Span: c-d:{(#1,RANGEKEYSET,_xyz)}
----
rangekey: [a#1,RANGEKEYSET-d#inf,RANGEKEYSET]
seqnums:  [1-1]

scan-range-key
----
a-b:{(#1,RANGEKEYSET,_xyz)}
b-c:{(#1,RANGEKEYSET,_xyz)}
c-d:{(#1,RANGEKEYSET,_xyz)}

rewrite from=_xyz to=_123 block-size=1 index-block-size=1 filter comparer=split-4b-suffix
----
point:    [#0,DEL-#0,DEL]
rangekey: [a#1,RANGEKEYSET-d#inf,RANGEKEYSET]
seqnums:  [0-1]

scan-range-key
----
a-b:{(#1,RANGEKEYSET,_123)}
b-c:{(#1,RANGEKEYSET,_123)}
c-d:{(#1,RANGEKEYSET,_123)}
