Skip to content

sstable: remove CompressionOptions #5150

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion replay/testdata/corpus/simple
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ simple/MANIFEST-000001:
size: 133
simple/MANIFEST-000008: stat simple/MANIFEST-000008: file does not exist
simple/000007.sst:
size: 614
size: 508
4 changes: 2 additions & 2 deletions replay/testdata/corpus/simple_ingest
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ simple_ingest/MANIFEST-000008:
size: 209
simple_ingest/MANIFEST-000010: stat simple_ingest/MANIFEST-000010: file does not exist
simple_ingest/000007.sst:
size: 765
size: 661
simple_ingest/000009.sst:
size: 759
size: 655
2 changes: 1 addition & 1 deletion replay/testdata/corpus/simple_val_sep
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ stat simple_val_sep/MANIFEST-000013 simple_val_sep/000015.sst simple_val_sep/000
simple_val_sep/MANIFEST-000013:
size: 250
simple_val_sep/000015.sst:
size: 873
size: 760
simple_val_sep/000016.blob:
size: 97
8 changes: 4 additions & 4 deletions replay/testdata/replay
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ tree
/
build/
89 000004.log
586 000005.sst
480 000005.sst
49 000006.log
614 000007.sst
508 000007.sst
0 LOCK
133 MANIFEST-000001
2799 OPTIONS-000003
0 marker.format-version.000001.013
0 marker.manifest.000001.MANIFEST-000001
simple/
614 000007.sst
508 000007.sst
133 MANIFEST-000001
checkpoint/
25 000004.log
586 000005.sst
480 000005.sst
85 MANIFEST-000001
2799 OPTIONS-000003
0 marker.format-version.000001.013
Expand Down
16 changes: 8 additions & 8 deletions replay/testdata/replay_ingest
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ tree
/
build/
36 000002.log
765 000005.sst
765 000007.sst
759 000009.sst
661 000005.sst
661 000007.sst
655 000009.sst
0 LOCK
172 MANIFEST-000001
209 MANIFEST-000008
2800 OPTIONS-000003
0 marker.format-version.000012.025
0 marker.manifest.000002.MANIFEST-000008
simple_ingest/
765 000007.sst
759 000009.sst
661 000007.sst
655 000009.sst
172 MANIFEST-000001
209 MANIFEST-000008
checkpoint/
25 000002.log
782 000004.sst
765 000005.sst
678 000004.sst
661 000005.sst
172 MANIFEST-000001
2800 OPTIONS-000003
0 marker.format-version.000001.025
Expand Down Expand Up @@ -158,7 +158,7 @@ replay simple_ingest unpaced

wait
----
replayed 1.5KB in writes
replayed 1.3KB in writes

scan-keys
----
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/
864 000005.sst
560 000007.sst
758 000005.sst
454 000007.sst
89 000008.log
560 000009.sst
454 000009.sst
200 000011.log
614 000012.sst
508 000012.sst
0 LOCK
133 MANIFEST-000001
205 MANIFEST-000010
2799 OPTIONS-000003
0 marker.format-version.000001.013
0 marker.manifest.000002.MANIFEST-000010
high_read_amp/
614 000012.sst
508 000012.sst
205 MANIFEST-000010
checkpoint/
864 000005.sst
560 000007.sst
758 000005.sst
454 000007.sst
39 000008.log
560 000009.sst
454 000009.sst
157 MANIFEST-000010
2799 OPTIONS-000003
0 marker.format-version.000001.013
Expand Down
16 changes: 8 additions & 8 deletions replay/testdata/replay_val_sep
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ tree
----
/
build/
900 000005.sst
787 000005.sst
101 000006.blob
879 000008.sst
766 000008.sst
97 000009.blob
92 000011.log
764 000012.sst
660 000012.sst
63 000014.log
873 000015.sst
760 000015.sst
97 000016.blob
0 LOCK
152 MANIFEST-000010
Expand All @@ -21,16 +21,16 @@ tree
0 marker.format-version.000011.024
0 marker.manifest.000003.MANIFEST-000013
simple_val_sep/
873 000015.sst
760 000015.sst
97 000016.blob
250 MANIFEST-000013
checkpoint/
900 000005.sst
787 000005.sst
101 000006.blob
879 000008.sst
766 000008.sst
97 000009.blob
64 000011.log
764 000012.sst
660 000012.sst
187 MANIFEST-000013
2936 OPTIONS-000003
0 marker.format-version.000001.024
Expand Down
1 change: 0 additions & 1 deletion sstable/colblk_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,6 @@ func (w *RawColumnWriter) Close() (err error) {

w.props.CompressionStats = w.layout.physBlockMaker.Compressor.Stats().String()
var toWrite []byte
w.props.CompressionOptions = rocksDBCompressionOptions
if w.opts.TableFormat >= TableFormatPebblev7 {
var cw colblk.KeyValueBlockWriter
cw.Init()
Expand Down
1 change: 1 addition & 0 deletions sstable/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var ignoredInternalProperties = map[string]struct{}{
"rocksdb.creation.time": {},
"rocksdb.file.creation.time": {},
"rocksdb.format.version": {},
"rocksdb.compression_options": {},
}

// FilterType exports the base.FilterType type.
Expand Down
10 changes: 5 additions & 5 deletions sstable/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ type CommonProperties struct {
NumTombstoneDenseBlocks uint64 `prop:"pebble.num.tombstone-dense-blocks"`
// The compression algorithm used to compress blocks.
CompressionName string `prop:"rocksdb.compression"`
// The compression options used to compress blocks.
CompressionOptions string `prop:"rocksdb.compression_options"`
}

// String is only used for testing purposes.
Expand Down Expand Up @@ -401,9 +399,6 @@ func (p *Properties) accumulateProps(tblFormat TableFormat) ([]string, map[strin
if p.CompressionName != "" {
p.saveString(m, unsafe.Offsetof(p.CompressionName), p.CompressionName)
}
if p.CompressionOptions != "" {
p.saveString(m, unsafe.Offsetof(p.CompressionOptions), p.CompressionOptions)
}
p.saveUvarint(m, unsafe.Offsetof(p.DataSize), p.DataSize)
if p.FilterPolicyName != "" {
p.saveString(m, unsafe.Offsetof(p.FilterPolicyName), p.FilterPolicyName)
Expand Down Expand Up @@ -486,6 +481,7 @@ func (p *Properties) accumulateProps(tblFormat TableFormat) ([]string, map[strin
m["rocksdb.oldest.key.time"] = singleZeroSlice
m["rocksdb.creation.time"] = singleZeroSlice
m["rocksdb.format.version"] = singleZeroSlice
m["rocksdb.compression_options"] = rocksDBCompressionOptions
}

keys := slices.Collect(maps.Keys(m))
Expand Down Expand Up @@ -554,4 +550,8 @@ func (p *Properties) toAttributes() Attributes {
var (
singleZeroSlice = []byte{0x00}
maxInt32Slice = binary.AppendUvarint([]byte(nil), math.MaxInt32)

// RocksDB always includes this in the properties block, so we include it for
// formats below TableFormatPebble.
rocksDBCompressionOptions = []byte("window_bits=-14; level=32767; strategy=0; max_dict_bytes=0; zstd_max_train_bytes=0; enabled=0; ")
)
16 changes: 7 additions & 9 deletions sstable/properties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ func TestPropertiesLoad(t *testing.T) {
defer leaktest.AfterTest(t)()
expected := Properties{
CommonProperties: CommonProperties{
NumEntries: 1727,
NumDeletions: 17,
NumRangeDeletions: 17,
RawKeySize: 23938,
RawValueSize: 1912,
NumDataBlocks: 14,
CompressionName: "Snappy",
CompressionOptions: "window_bits=-14; level=32767; strategy=0; max_dict_bytes=0; zstd_max_train_bytes=0; enabled=0; ",
NumEntries: 1727,
NumDeletions: 17,
NumRangeDeletions: 17,
RawKeySize: 23938,
RawValueSize: 1912,
NumDataBlocks: 14,
CompressionName: "Snappy",
},
ComparerName: "leveldb.BytewiseComparator",
DataSize: 13913,
Expand Down Expand Up @@ -75,7 +74,6 @@ var testProps = Properties{
NumDataBlocks: 14,
NumTombstoneDenseBlocks: 2,
CompressionName: "compression name",
CompressionOptions: "compression option",
},
ComparerName: "comparator name",
DataSize: 3,
Expand Down
1 change: 0 additions & 1 deletion sstable/rowblk_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,6 @@ func (w *RawRowWriter) Close() (err error) {
// is always read sequentially and cached in a heap located object. This
// reduces table size without a significant impact on performance.
raw.RestartInterval = propertiesBlockRestartInterval
w.props.CompressionOptions = rocksDBCompressionOptions
if err := w.props.saveToRowWriter(w.tableFormat, &raw); err != nil {
return err
}
Expand Down
6 changes: 0 additions & 6 deletions sstable/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,6 @@ const (
// A two-level index implementation. Both levels are binary search indexes.
twoLevelIndex = 2
// binarySearchWithFirstKeyIndex = 3

// RocksDB always includes this in the properties block. Since Pebble
// doesn't use zstd compression, the string will always be the same.
// This should be removed if we ever decide to diverge from the RocksDB
// properties block.
rocksDBCompressionOptions = "window_bits=-14; level=32767; strategy=0; max_dict_bytes=0; zstd_max_train_bytes=0; enabled=0; "
)

// footer formats. Note that much of the existing footer parsing code assumes
Expand Down
Loading