diff --git a/sstable/properties_test.go b/sstable/properties_test.go index 09c719dd4a..8794c5382b 100644 --- a/sstable/properties_test.go +++ b/sstable/properties_test.go @@ -36,11 +36,8 @@ func TestPropertiesLoad(t *testing.T) { MergerName: "nullptr", NumDataBlocks: 14, PrefixExtractorName: "nullptr", - PropertyCollectorNames: "[KeyCountPropertyCollector]", - UserProperties: map[string]string{ - "test.key-count": "1727", - }, - WholeKeyFiltering: false, + PropertyCollectorNames: "[]", + WholeKeyFiltering: false, } { diff --git a/sstable/table_test.go b/sstable/table_test.go index 7fc535f99b..8ba0dc21e8 100644 --- a/sstable/table_test.go +++ b/sstable/table_test.go @@ -418,7 +418,7 @@ func TestWriterRoundTrip(t *testing.T) { fs := vfs.NewMem() err := buildHamletTestSST( fs, "test.sst", DefaultCompression, fp, TableFilter, - nil /* comparer */, nil /* propCollector */, blockSize, indexBlockSize, + nil /* comparer */, blockSize, indexBlockSize, ) require.NoError(t, err) // Check that we can read a freshly made table. @@ -519,7 +519,7 @@ func TestReaderGlobalSeqNum(t *testing.T) { func TestMetaIndexEntriesSorted(t *testing.T) { fs := vfs.NewMem() err := buildHamletTestSST(fs, "test.sst", DefaultCompression, nil, /* filter policy */ - TableFilter, nil, nil, 4096, 4096) + TableFilter, nil, 4096, 4096) require.NoError(t, err) f, err := fs.Open("test.sst") require.NoError(t, err) diff --git a/sstable/test_fixtures.go b/sstable/test_fixtures.go index 072c841e57..d31cc721ea 100644 --- a/sstable/test_fixtures.go +++ b/sstable/test_fixtures.go @@ -123,7 +123,6 @@ func buildHamletTestSST( fp FilterPolicy, ftype FilterType, comparer *Comparer, - propCollector func() TablePropertyCollector, blockSize int, indexBlockSize int, ) error { @@ -146,9 +145,6 @@ func buildHamletTestSST( MergerName: "nullptr", TableFormat: fixtureFormat, } - if propCollector != nil { - writerOpts.TablePropertyCollectors = append(writerOpts.TablePropertyCollectors, propCollector) - } w := NewWriter(objstorageprovider.NewFileWritable(f0), writerOpts) // Use rangeDelV1Format for testing byte equality with RocksDB. @@ -182,79 +178,71 @@ func buildHamletTestSST( // TestFixtureInfo contains all metadata necessary to generate a test sstable. type TestFixtureInfo struct { - Filename string - Compression Compression - FullKeyFilter bool - PrefixFilter bool - IndexBlockSize int - UseFixtureComparer bool - KeyCountPropertyCollector bool + Filename string + Compression Compression + FullKeyFilter bool + PrefixFilter bool + IndexBlockSize int + UseFixtureComparer bool } // TestFixtures contains all metadata necessary to generate the test SSTs. var TestFixtures = []TestFixtureInfo{ { - Filename: "h.sst", - Compression: SnappyCompression, - FullKeyFilter: false, - PrefixFilter: false, - IndexBlockSize: fixtureDefaultIndexBlockSize, - UseFixtureComparer: false, - KeyCountPropertyCollector: true, + Filename: "h.sst", + Compression: SnappyCompression, + FullKeyFilter: false, + PrefixFilter: false, + IndexBlockSize: fixtureDefaultIndexBlockSize, + UseFixtureComparer: false, }, { - Filename: "h.no-compression.sst", - Compression: NoCompression, - FullKeyFilter: false, - PrefixFilter: false, - IndexBlockSize: fixtureDefaultIndexBlockSize, - UseFixtureComparer: false, - KeyCountPropertyCollector: true, + Filename: "h.no-compression.sst", + Compression: NoCompression, + FullKeyFilter: false, + PrefixFilter: false, + IndexBlockSize: fixtureDefaultIndexBlockSize, + UseFixtureComparer: false, }, { - Filename: "h.table-bloom.sst", - Compression: SnappyCompression, - FullKeyFilter: true, - PrefixFilter: false, - IndexBlockSize: fixtureDefaultIndexBlockSize, - UseFixtureComparer: false, - KeyCountPropertyCollector: false, + Filename: "h.table-bloom.sst", + Compression: SnappyCompression, + FullKeyFilter: true, + PrefixFilter: false, + IndexBlockSize: fixtureDefaultIndexBlockSize, + UseFixtureComparer: false, }, { - Filename: "h.table-bloom.no-compression.sst", - Compression: NoCompression, - FullKeyFilter: true, - PrefixFilter: false, - IndexBlockSize: fixtureDefaultIndexBlockSize, - UseFixtureComparer: false, - KeyCountPropertyCollector: false, + Filename: "h.table-bloom.no-compression.sst", + Compression: NoCompression, + FullKeyFilter: true, + PrefixFilter: false, + IndexBlockSize: fixtureDefaultIndexBlockSize, + UseFixtureComparer: false, }, { - Filename: "h.table-bloom.no-compression.prefix_extractor.no_whole_key_filter.sst", - Compression: NoCompression, - FullKeyFilter: false, - PrefixFilter: true, - IndexBlockSize: fixtureDefaultIndexBlockSize, - UseFixtureComparer: true, - KeyCountPropertyCollector: false, + Filename: "h.table-bloom.no-compression.prefix_extractor.no_whole_key_filter.sst", + Compression: NoCompression, + FullKeyFilter: false, + PrefixFilter: true, + IndexBlockSize: fixtureDefaultIndexBlockSize, + UseFixtureComparer: true, }, { - Filename: "h.no-compression.two_level_index.sst", - Compression: NoCompression, - FullKeyFilter: false, - PrefixFilter: false, - IndexBlockSize: fixtureSmallIndexBlockSize, - UseFixtureComparer: false, - KeyCountPropertyCollector: true, + Filename: "h.no-compression.two_level_index.sst", + Compression: NoCompression, + FullKeyFilter: false, + PrefixFilter: false, + IndexBlockSize: fixtureSmallIndexBlockSize, + UseFixtureComparer: false, }, { - Filename: "h.zstd-compression.sst", - Compression: ZstdCompression, - FullKeyFilter: false, - PrefixFilter: false, - IndexBlockSize: fixtureDefaultIndexBlockSize, - UseFixtureComparer: false, - KeyCountPropertyCollector: true, + Filename: "h.zstd-compression.sst", + Compression: ZstdCompression, + FullKeyFilter: false, + PrefixFilter: false, + IndexBlockSize: fixtureDefaultIndexBlockSize, + UseFixtureComparer: false, }, } @@ -268,17 +256,10 @@ func (tf TestFixtureInfo) Build(fs vfs.FS, filename string) error { if tf.UseFixtureComparer { comparer = fixtureComparer } - var propCollector func() TablePropertyCollector - if tf.KeyCountPropertyCollector { - propCollector = func() TablePropertyCollector { - return &keyCountPropertyCollector{} - } - } return buildHamletTestSST( fs, filename, tf.Compression, fp, base.TableFilter, comparer, - propCollector, fixtureBlockSize, tf.IndexBlockSize, ) @@ -289,24 +270,6 @@ const fixtureSmallIndexBlockSize = 128 const fixtureBlockSize = 2048 const fixtureFormat = TableFormatPebblev1 -type keyCountPropertyCollector struct { - count int -} - -func (c *keyCountPropertyCollector) Add(key InternalKey, value []byte) error { - c.count++ - return nil -} - -func (c *keyCountPropertyCollector) Finish(userProps map[string]string) error { - userProps["test.key-count"] = fmt.Sprint(c.count) - return nil -} - -func (c *keyCountPropertyCollector) Name() string { - return "KeyCountPropertyCollector" -} - var fixtureComparer = func() *Comparer { c := *base.DefaultComparer // NB: this is named as such only to match the built-in RocksDB comparer. diff --git a/sstable/testdata/h.no-compression.sst b/sstable/testdata/h.no-compression.sst index b5f1f075e6..34e7e4d33f 100644 Binary files a/sstable/testdata/h.no-compression.sst and b/sstable/testdata/h.no-compression.sst differ diff --git a/sstable/testdata/h.no-compression.two_level_index.sst b/sstable/testdata/h.no-compression.two_level_index.sst index 38ac0f8e64..82289bb1d1 100644 Binary files a/sstable/testdata/h.no-compression.two_level_index.sst and b/sstable/testdata/h.no-compression.two_level_index.sst differ diff --git a/sstable/testdata/h.sst b/sstable/testdata/h.sst index 5e6e331acc..8b792034ff 100644 Binary files a/sstable/testdata/h.sst and b/sstable/testdata/h.sst differ diff --git a/sstable/testdata/h.zstd-compression.sst b/sstable/testdata/h.zstd-compression.sst index b37bbc48fe..0f6ccf333c 100644 Binary files a/sstable/testdata/h.zstd-compression.sst and b/sstable/testdata/h.zstd-compression.sst differ diff --git a/tool/testdata/sstable_layout b/tool/testdata/sstable_layout index 6a2171105d..58da2056e2 100644 --- a/tool/testdata/sstable_layout +++ b/tool/testdata/sstable_layout @@ -22,10 +22,10 @@ h.sst 13752 data (156) 13913 index (245) 14163 range-del (421) - 14589 properties (582) - 15176 meta-index (61) - 15242 footer (53) - 15295 EOF + 14589 properties (536) + 15130 meta-index (61) + 15196 footer (53) + 15249 EOF sstable layout ../sstable/testdata/h.table-bloom.no-compression.sst @@ -76,10 +76,10 @@ h.no-compression.two_level_index.sst 27047 index (95) 27147 top-index (70) 27222 range-del (421) - 27648 properties (628) - 28281 meta-index (63) - 28349 footer (53) - 28402 EOF + 27648 properties (582) + 28235 meta-index (63) + 28303 footer (53) + 28356 EOF sstable layout -v @@ -3744,7 +3744,7 @@ h.no-compression.two_level_index.sst 27631 [restart 27523] 27635 [restart 27546] 27643 [trailer compression=none checksum=0xb93b31c5] - 27648 properties (628) + 27648 properties (582) 27648 rocksdb.block.based.table.index.type (43) [restart] 27691 rocksdb.block.based.table.prefix.filtering (20) 27711 rocksdb.block.based.table.whole.key.filtering (23) @@ -3764,27 +3764,26 @@ h.no-compression.two_level_index.sst 28081 rocksdb.num.entries (12) 28093 rocksdb.num.range-deletions (19) 28112 rocksdb.prefix.extractor.name (31) - 28143 rocksdb.property.collectors (47) - 28190 rocksdb.raw.key.size (18) - 28208 rocksdb.raw.value.size (15) - 28223 rocksdb.top-level.index.size (24) - 28247 test.key-count (21) - 28268 [restart 27648] - 28276 [trailer compression=none checksum=0xdddd20b2] - 28281 meta-index (63) - 28281 rocksdb.properties block:27648/628 [restart] - 28307 rocksdb.range_del block:27222/421 [restart] - 28332 [restart 28281] - 28336 [restart 28307] - 28344 [trailer compression=none checksum=0xc1962fe1] - 28349 footer (53) - 28349 checksum type: crc32c - 28350 meta: offset=28281, length=63 - 28354 index: offset=27147, length=70 - 28358 [padding] - 28390 version: 1 - 28394 magic number: 0xf09faab3f09faab3 - 28402 EOF + 28143 rocksdb.property.collectors (22) + 28165 rocksdb.raw.key.size (18) + 28183 rocksdb.raw.value.size (15) + 28198 rocksdb.top-level.index.size (24) + 28222 [restart 27648] + 28230 [trailer compression=none checksum=0x9414996] + 28235 meta-index (63) + 28235 rocksdb.properties block:27648/582 [restart] + 28261 rocksdb.range_del block:27222/421 [restart] + 28286 [restart 28235] + 28290 [restart 28261] + 28298 [trailer compression=none checksum=0x9e135f62] + 28303 footer (53) + 28303 checksum type: crc32c + 28304 meta: offset=28235, length=63 + 28308 index: offset=27147, length=70 + 28312 [padding] + 28344 version: 1 + 28348 magic number: 0xf09faab3f09faab3 + 28356 EOF sstable layout -v diff --git a/tool/testdata/sstable_properties b/tool/testdata/sstable_properties index 1a39425dae..e0735ae54b 100644 Binary files a/tool/testdata/sstable_properties and b/tool/testdata/sstable_properties differ