Skip to content

Commit

Permalink
sstable: remove unused properties around prefix extraction
Browse files Browse the repository at this point in the history
Remove `PrefixExtractor`, `PrefixFiltering`, `WholeKeyFiltering`
sstable properties. We are not using them anywhere and they introduce
an unnecessary distinction between having no `Split` function and
having a trivial one. The name of the comparer is sufficient to
associate the correct `Split` function.
  • Loading branch information
RaduBerinde committed Feb 27, 2024
1 parent 86c76bf commit b6abd22
Show file tree
Hide file tree
Showing 39 changed files with 490 additions and 534 deletions.
2 changes: 1 addition & 1 deletion db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ func TestTracing(t *testing.T) {
_, closer, err := d.Get([]byte("hello"))
require.NoError(t, err)
closer.Close()
readerInitTraceString := "reading 37 bytes took 5ms\nreading 491 bytes took 5ms\n"
readerInitTraceString := "reading 37 bytes took 5ms\nreading 419 bytes took 5ms\n"
iterTraceString := "reading 27 bytes took 5ms\nreading 29 bytes took 5ms\n"
require.Equal(t, readerInitTraceString+iterTraceString, tracer.buf.String())

Expand Down
2 changes: 1 addition & 1 deletion replay/testdata/corpus/simple
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ simple/MANIFEST-000001:
simple/MANIFEST-000008:
size: 122
simple/000007.sst:
size: 686
size: 614
8 changes: 4 additions & 4 deletions replay/testdata/replay
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ tree
/
build/
89 000004.log
658 000005.sst
586 000005.sst
49 000006.log
686 000007.sst
614 000007.sst
0 LOCK
98 MANIFEST-000001
122 MANIFEST-000008
1211 OPTIONS-000003
0 marker.format-version.000001.013
0 marker.manifest.000002.MANIFEST-000008
simple/
686 000007.sst
614 000007.sst
98 MANIFEST-000001
122 MANIFEST-000008
checkpoint/
25 000004.log
658 000005.sst
586 000005.sst
98 MANIFEST-000001
1211 OPTIONS-000003
0 marker.format-version.000001.013
Expand Down
16 changes: 8 additions & 8 deletions replay/testdata/replay_paced
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ tree
----
/
build/
936 000005.sst
632 000007.sst
864 000005.sst
560 000007.sst
89 000009.log
632 000010.sst
560 000010.sst
200 000012.log
686 000013.sst
614 000013.sst
0 LOCK
122 MANIFEST-000008
205 MANIFEST-000011
1211 OPTIONS-000003
0 marker.format-version.000001.013
0 marker.manifest.000003.MANIFEST-000011
high_read_amp/
686 000013.sst
614 000013.sst
205 MANIFEST-000011
checkpoint/
936 000005.sst
632 000007.sst
864 000005.sst
560 000007.sst
39 000009.log
632 000010.sst
560 000010.sst
157 MANIFEST-000011
1211 OPTIONS-000003
0 marker.format-version.000001.013
Expand Down
12 changes: 0 additions & 12 deletions sstable/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,6 @@ type Properties struct {
NumValueBlocks uint64 `prop:"pebble.num.value-blocks"`
// The number of values stored in value blocks. Only serialized if > 0.
NumValuesInValueBlocks uint64 `prop:"pebble.num.values.in.value-blocks"`
// The name of the prefix extractor used in this table. Empty if no prefix
// extractor is used.
PrefixExtractorName string `prop:"rocksdb.prefix.extractor.name"`
// If filtering is enabled, was the filter created on the key prefix.
PrefixFiltering bool `prop:"rocksdb.block.based.table.prefix.filtering"`
// A comma separated list of names of the property collectors used in this
// table.
PropertyCollectorNames string `prop:"rocksdb.property.collectors"`
Expand All @@ -187,8 +182,6 @@ type Properties struct {
TopLevelIndexSize uint64 `prop:"rocksdb.top-level.index.size"`
// User collected properties.
UserProperties map[string]string
// If filtering is enabled, was the filter created on the whole key.
WholeKeyFiltering bool `prop:"rocksdb.block.based.table.whole.key.filtering"`

// Loaded set indicating which fields have been loaded from disk. Indexed by
// the field's byte offset within the struct
Expand Down Expand Up @@ -402,10 +395,6 @@ func (p *Properties) save(tblFormat TableFormat, w *rawBlockWriter) {
if p.NumValuesInValueBlocks > 0 {
p.saveUvarint(m, unsafe.Offsetof(p.NumValuesInValueBlocks), p.NumValuesInValueBlocks)
}
if p.PrefixExtractorName != "" {
p.saveString(m, unsafe.Offsetof(p.PrefixExtractorName), p.PrefixExtractorName)
}
p.saveBool(m, unsafe.Offsetof(p.PrefixFiltering), p.PrefixFiltering)
if p.PropertyCollectorNames != "" {
p.saveString(m, unsafe.Offsetof(p.PropertyCollectorNames), p.PropertyCollectorNames)
}
Expand All @@ -419,7 +408,6 @@ func (p *Properties) save(tblFormat TableFormat, w *rawBlockWriter) {
if p.ValueBlocksSize > 0 {
p.saveUvarint(m, unsafe.Offsetof(p.ValueBlocksSize), p.ValueBlocksSize)
}
p.saveBool(m, unsafe.Offsetof(p.WholeKeyFiltering), p.WholeKeyFiltering)

if tblFormat < TableFormatPebblev1 {
m["rocksdb.column.family.id"] = binary.AppendUvarint([]byte(nil), math.MaxInt32)
Expand Down
5 changes: 0 additions & 5 deletions sstable/properties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ func TestPropertiesLoad(t *testing.T) {
IndexSize: 325,
MergerName: "nullptr",
NumDataBlocks: 14,
PrefixExtractorName: "nullptr",
PropertyCollectorNames: "[]",
WholeKeyFiltering: false,
}

{
Expand Down Expand Up @@ -85,11 +83,8 @@ var testProps = Properties{
NumRangeKeyUnsets: 21,
NumValueBlocks: 22,
NumValuesInValueBlocks: 23,
PrefixExtractorName: "prefix extractor name",
PrefixFiltering: true,
PropertyCollectorNames: "prefix collector names",
TopLevelIndexSize: 27,
WholeKeyFiltering: true,
UserProperties: map[string]string{
"user-prop-a": "1",
"user-prop-b": "2",
Expand Down
Binary file modified sstable/testdata/h.no-compression.sst
Binary file not shown.
Binary file modified sstable/testdata/h.no-compression.two_level_index.sst
Binary file not shown.
Binary file modified sstable/testdata/h.sst
Binary file not shown.
Binary file not shown.
Binary file modified sstable/testdata/h.table-bloom.no-compression.sst
Binary file not shown.
Binary file modified sstable/testdata/h.table-bloom.sst
Binary file not shown.
Binary file modified sstable/testdata/h.zstd-compression.sst
Binary file not shown.
40 changes: 20 additions & 20 deletions sstable/testdata/rewriter
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ layout
191 index (22)
218 index (22)
245 top-index (48)
298 properties (607)
910 meta-index (79)
994 footer (53)
1047 EOF
298 properties (518)
821 meta-index (79)
905 footer (53)
958 EOF

scan
----
Expand Down Expand Up @@ -83,10 +83,10 @@ layout
191 index (22)
218 index (22)
245 top-index (48)
298 properties (607)
910 meta-index (79)
994 footer (53)
1047 EOF
298 properties (518)
821 meta-index (79)
905 footer (53)
958 EOF

scan
----
Expand Down Expand Up @@ -118,10 +118,10 @@ layout
191 index (22)
218 index (22)
245 top-index (48)
298 properties (607)
910 meta-index (79)
994 footer (53)
1047 EOF
298 properties (518)
821 meta-index (79)
905 footer (53)
958 EOF

scan
----
Expand Down Expand Up @@ -153,10 +153,10 @@ layout
191 index (22)
218 index (22)
245 top-index (48)
298 properties (607)
910 meta-index (79)
994 footer (53)
1047 EOF
298 properties (518)
821 meta-index (79)
905 footer (53)
958 EOF

scan
----
Expand Down Expand Up @@ -189,10 +189,10 @@ layout
191 index (22)
218 index (22)
245 top-index (48)
298 properties (607)
910 meta-index (79)
994 footer (53)
1047 EOF
298 properties (518)
821 meta-index (79)
905 footer (53)
958 EOF

scan
----
Expand Down
40 changes: 20 additions & 20 deletions sstable/testdata/rewriter_v3
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ layout
194 index (22)
221 index (22)
248 top-index (48)
301 properties (607)
913 meta-index (79)
997 footer (53)
1050 EOF
301 properties (518)
824 meta-index (79)
908 footer (53)
961 EOF

scan
----
Expand Down Expand Up @@ -83,10 +83,10 @@ layout
194 index (22)
221 index (22)
248 top-index (48)
301 properties (607)
913 meta-index (79)
997 footer (53)
1050 EOF
301 properties (518)
824 meta-index (79)
908 footer (53)
961 EOF

scan
----
Expand Down Expand Up @@ -118,10 +118,10 @@ layout
194 index (22)
221 index (22)
248 top-index (48)
301 properties (607)
913 meta-index (79)
997 footer (53)
1050 EOF
301 properties (518)
824 meta-index (79)
908 footer (53)
961 EOF

scan
----
Expand Down Expand Up @@ -153,10 +153,10 @@ layout
194 index (22)
221 index (22)
248 top-index (48)
301 properties (607)
913 meta-index (79)
997 footer (53)
1050 EOF
301 properties (518)
824 meta-index (79)
908 footer (53)
961 EOF

scan
----
Expand Down Expand Up @@ -189,10 +189,10 @@ layout
194 index (22)
221 index (22)
248 top-index (48)
301 properties (607)
913 meta-index (79)
997 footer (53)
1050 EOF
301 properties (518)
824 meta-index (79)
908 footer (53)
961 EOF

scan
----
Expand Down
10 changes: 5 additions & 5 deletions sstable/testdata/virtual_reader
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ virtualize dd.SET.5-ddd.SET.6
----
bounds: [dd#5,1-ddd#6,1]
filenum: 000004
props: NumEntries: 2, RawKeySize: 10, RawValueSize: 2, RawPointTombstoneKeySize: 0, RawPointTombstoneValueSize: 0, NumSizedDeletions: 0, NumDeletions: 0, NumRangeDeletions: 0, NumRangeKeyDels: 0, NumRangeKeySets: 0, ValueBlocksSize: 0
props: NumEntries: 2, RawKeySize: 11, RawValueSize: 2, RawPointTombstoneKeySize: 0, RawPointTombstoneValueSize: 0, NumSizedDeletions: 0, NumDeletions: 0, NumRangeDeletions: 0, NumRangeKeyDels: 0, NumRangeKeySets: 0, ValueBlocksSize: 0

# Check lower bound enforcement during SeekPrefixGE.
iter
Expand Down Expand Up @@ -190,7 +190,7 @@ virtualize c.SET.3-f.SET.6
----
bounds: [c#3,1-f#6,1]
filenum: 000005
props: NumEntries: 2, RawKeySize: 10, RawValueSize: 2, RawPointTombstoneKeySize: 0, RawPointTombstoneValueSize: 0, NumSizedDeletions: 0, NumDeletions: 0, NumRangeDeletions: 0, NumRangeKeyDels: 0, NumRangeKeySets: 0, ValueBlocksSize: 0
props: NumEntries: 2, RawKeySize: 11, RawValueSize: 2, RawPointTombstoneKeySize: 0, RawPointTombstoneValueSize: 0, NumSizedDeletions: 0, NumDeletions: 0, NumRangeDeletions: 0, NumRangeKeyDels: 0, NumRangeKeySets: 0, ValueBlocksSize: 0

# Just test a basic iterator once virtual sstable bounds have been set.
iter
Expand Down Expand Up @@ -290,7 +290,7 @@ virtualize c.SET.3-f.SET.1:ff
----
bounds: [c#3,1-f#0,1]
filenum: 000006
props: NumEntries: 2, RawKeySize: 12, RawValueSize: 2, RawPointTombstoneKeySize: 0, RawPointTombstoneValueSize: 0, NumSizedDeletions: 0, NumDeletions: 0, NumRangeDeletions: 0, NumRangeKeyDels: 0, NumRangeKeySets: 0, ValueBlocksSize: 3
props: NumEntries: 2, RawKeySize: 13, RawValueSize: 2, RawPointTombstoneKeySize: 0, RawPointTombstoneValueSize: 0, NumSizedDeletions: 0, NumDeletions: 0, NumRangeDeletions: 0, NumRangeKeyDels: 0, NumRangeKeySets: 0, ValueBlocksSize: 3

iter
set-bounds lower=d upper=e
Expand Down Expand Up @@ -343,7 +343,7 @@ virtualize f.SET.6-h.SET.9
----
bounds: [f#6,1-h#9,1]
filenum: 000007
props: NumEntries: 2, RawKeySize: 12, RawValueSize: 2, RawPointTombstoneKeySize: 0, RawPointTombstoneValueSize: 0, NumSizedDeletions: 0, NumDeletions: 0, NumRangeDeletions: 0, NumRangeKeyDels: 0, NumRangeKeySets: 0, ValueBlocksSize: 3
props: NumEntries: 2, RawKeySize: 13, RawValueSize: 2, RawPointTombstoneKeySize: 0, RawPointTombstoneValueSize: 0, NumSizedDeletions: 0, NumDeletions: 0, NumRangeDeletions: 0, NumRangeKeyDels: 0, NumRangeKeySets: 0, ValueBlocksSize: 3

iter
seek-lt z
Expand Down Expand Up @@ -713,7 +713,7 @@ virtualize [email protected]@4.SET.8 suffix=@8
----
bounds: [c@7#3,1-f@4#8,1]
filenum: 000015
props: NumEntries: 2, RawKeySize: 13, RawValueSize: 2, RawPointTombstoneKeySize: 0, RawPointTombstoneValueSize: 0, NumSizedDeletions: 0, NumDeletions: 0, NumRangeDeletions: 0, NumRangeKeyDels: 0, NumRangeKeySets: 0, ValueBlocksSize: 0
props: NumEntries: 2, RawKeySize: 15, RawValueSize: 2, RawPointTombstoneKeySize: 0, RawPointTombstoneValueSize: 0, NumSizedDeletions: 0, NumDeletions: 0, NumRangeDeletions: 0, NumRangeKeyDels: 0, NumRangeKeySets: 0, ValueBlocksSize: 0

# Just test a basic iterator once virtual sstable bounds have been set.
iter
Expand Down
24 changes: 12 additions & 12 deletions sstable/testdata/writer
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,10 @@ layout
105 index (22)
132 index (22)
159 top-index (50)
214 properties (557)
776 meta-index (33)
814 footer (53)
867 EOF
214 properties (485)
704 meta-index (33)
742 footer (53)
795 EOF

scan
----
Expand All @@ -344,10 +344,10 @@ layout
26 data (21)
52 data (21)
78 index (47)
130 properties (655)
790 meta-index (33)
828 leveldb-footer (48)
876 EOF
130 properties (583)
718 meta-index (33)
756 leveldb-footer (48)
804 EOF

# Range keys, if present, are shown in the layout.

Expand All @@ -364,7 +364,7 @@ layout
0 data (8)
13 index (21)
39 range-key (82)
126 properties (605)
736 meta-index (57)
798 footer (53)
851 EOF
126 properties (533)
664 meta-index (57)
726 footer (53)
779 EOF
Loading

0 comments on commit b6abd22

Please sign in to comment.