Skip to content

Commit

Permalink
colblk: don't use InitWithDefault for block lengths
Browse files Browse the repository at this point in the history
Having a default value for lengths is unnecessary and can lead to
worse encodings.
  • Loading branch information
RaduBerinde committed Oct 15, 2024
1 parent 88babd7 commit 8989e4e
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 82 deletions.
2 changes: 1 addition & 1 deletion sstable/colblk/index_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const (
func (w *IndexBlockWriter) Init() {
w.separators.Init()
w.offsets.Init()
w.lengths.InitWithDefault()
w.lengths.Init()
w.blockProperties.Init()
w.rows = 0
}
Expand Down
20 changes: 10 additions & 10 deletions testdata/checkpoint
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ g 10
scan db
----
open: db/000010.sst (options: *vfs.randomReadsOption)
read-at(622, 53): db/000010.sst
read-at(584, 38): db/000010.sst
read-at(137, 447): db/000010.sst
read-at(96, 41): db/000010.sst
read-at(0, 96): db/000010.sst
read-at(626, 53): db/000010.sst
read-at(588, 38): db/000010.sst
read-at(141, 447): db/000010.sst
read-at(100, 41): db/000010.sst
read-at(0, 100): db/000010.sst
a 1
b 5
c 3
Expand Down Expand Up @@ -546,11 +546,11 @@ close: checkpoints/checkpoint4/000008.log
scan checkpoints/checkpoint4
----
open: checkpoints/checkpoint4/000010.sst (options: *vfs.randomReadsOption)
read-at(622, 53): checkpoints/checkpoint4/000010.sst
read-at(584, 38): checkpoints/checkpoint4/000010.sst
read-at(137, 447): checkpoints/checkpoint4/000010.sst
read-at(96, 41): checkpoints/checkpoint4/000010.sst
read-at(0, 96): checkpoints/checkpoint4/000010.sst
read-at(626, 53): checkpoints/checkpoint4/000010.sst
read-at(588, 38): checkpoints/checkpoint4/000010.sst
read-at(141, 447): checkpoints/checkpoint4/000010.sst
read-at(100, 41): checkpoints/checkpoint4/000010.sst
read-at(0, 100): checkpoints/checkpoint4/000010.sst
a 1
b 5
d 7
Expand Down
6 changes: 3 additions & 3 deletions testdata/compaction_delete_only_hints
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ L0.000001 a-z seqnums(tombstone=5-27, file-smallest=0, type=point-key-only)
close-snapshot
10
----
[JOB 100] compacted(elision-only) L6 [000004] (749B) Score=0.00 + L6 [] (0B) Score=0.00 -> L6 [000005] (656B), in 1.0s (2.0s total), output rate 656B/s
[JOB 100] compacted(elision-only) L6 [000004] (743B) Score=0.00 + L6 [] (0B) Score=0.00 -> L6 [000005] (662B), in 1.0s (2.0s total), output rate 662B/s

# In previous versions of the code, the deletion hint was removed by the
# elision-only compaction because it zeroed sequence numbers of keys with
Expand Down Expand Up @@ -542,7 +542,7 @@ maybe-compact
Deletion hints:
(none)
Compactions:
[JOB 100] compacted(delete-only) L6 [000005] (657B) Score=0.00 -> L6 [] (0B), in 1.0s (2.0s total), output rate 0B/s
[JOB 100] compacted(delete-only) L6 [000005] (660B) Score=0.00 -> L6 [] (0B), in 1.0s (2.0s total), output rate 0B/s

describe-lsm
----
Expand Down Expand Up @@ -608,7 +608,7 @@ maybe-compact
Deletion hints:
(none)
Compactions:
[JOB 100] compacted(delete-only) L6 [000004] (851B) Score=0.00 -> L6 [000007 000008] (176B), in 1.0s (2.0s total), output rate 176B/s
[JOB 100] compacted(delete-only) L6 [000004] (849B) Score=0.00 -> L6 [000007 000008] (186B), in 1.0s (2.0s total), output rate 186B/s

describe-lsm
----
Expand Down
6 changes: 3 additions & 3 deletions testdata/compaction_picker_pick_file
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ L5:
000005:[f#11,SET-f#11,SET]: 57942 bytes (57KB)
L6:
000006:[c#0,SET-c#0,SET]: 66134 bytes (65KB)
000009:[d#13,SET-d#13,SET]: 654 bytes (654B)
000009:[d#13,SET-d#13,SET]: 660 bytes (660B)
000007:[e#0,SET-e#0,SET]: 66134 bytes (65KB)
000008:[f#0,SET-f#0,SET]: 66134 bytes (65KB)

Expand Down Expand Up @@ -209,8 +209,8 @@ L5:
000011:[e#11,SET-e#11,SET]: 126 bytes (126B)
000005:[f#11,SET-f#11,SET]: 57942 bytes (57KB)
L6:
000012:[c#15,SET-c#15,SET]: 654 bytes (654B)
000009:[d#13,SET-d#13,SET]: 654 bytes (654B)
000012:[c#15,SET-c#15,SET]: 660 bytes (660B)
000009:[d#13,SET-d#13,SET]: 660 bytes (660B)
000007:[e#0,SET-e#0,SET]: 66134 bytes (65KB)
000008:[f#0,SET-f#0,SET]: 66134 bytes (65KB)

Expand Down
10 changes: 5 additions & 5 deletions testdata/compaction_tombstones
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ range-deletions-bytes-estimate: 0

maybe-compact
----
[JOB 100] compacted(elision-only) L6 [000004] (711B) Score=0.00 + L6 [] (0B) Score=0.00 -> L6 [000005] (656B), in 1.0s (2.0s total), output rate 656B/s
[JOB 100] compacted(elision-only) L6 [000004] (711B) Score=0.00 + L6 [] (0B) Score=0.00 -> L6 [000005] (662B), in 1.0s (2.0s total), output rate 662B/s

version
----
Expand Down Expand Up @@ -119,7 +119,7 @@ wait-pending-table-stats
num-entries: 6
num-deletions: 2
num-range-key-sets: 0
point-deletions-bytes-estimate: 46
point-deletions-bytes-estimate: 45
range-deletions-bytes-estimate: 101

maybe-compact
Expand All @@ -134,7 +134,7 @@ close-snapshot
close-snapshot
103
----
[JOB 100] compacted(elision-only) L6 [000004] (881B) Score=0.00 + L6 [] (0B) Score=0.00 -> L6 [] (0B), in 1.0s (2.0s total), output rate 0B/s
[JOB 100] compacted(elision-only) L6 [000004] (875B) Score=0.00 + L6 [] (0B) Score=0.00 -> L6 [] (0B), in 1.0s (2.0s total), output rate 0B/s

# Test a table that contains both deletions and non-deletions, but whose
# non-deletions well outnumber its deletions. The table should not be
Expand Down Expand Up @@ -208,7 +208,7 @@ range-deletions-bytes-estimate: 16824

maybe-compact
----
[JOB 100] compacted(default) L5 [000004 000005] (26KB) Score=88.36 + L6 [000007] (17KB) Score=0.73 -> L6 [000009] (25KB), in 1.0s (2.0s total), output rate 25KB/s
[JOB 100] compacted(default) L5 [000004 000005] (26KB) Score=88.38 + L6 [000007] (17KB) Score=0.73 -> L6 [000009] (25KB), in 1.0s (2.0s total), output rate 25KB/s

define level-max-bytes=(L5 : 1000) auto-compactions=off
L5
Expand Down Expand Up @@ -323,7 +323,7 @@ range-deletions-bytes-estimate: 94

maybe-compact
----
[JOB 100] compacted(elision-only) L6 [000004] (938B) Score=0.00 + L6 [] (0B) Score=0.00 -> L6 [000005] (657B), in 1.0s (2.0s total), output rate 657B/s
[JOB 100] compacted(elision-only) L6 [000004] (926B) Score=0.00 + L6 [] (0B) Score=0.00 -> L6 [000005] (660B), in 1.0s (2.0s total), output rate 660B/s

# Close the DB, asserting that the reference counts balance.
close
Expand Down
56 changes: 28 additions & 28 deletions testdata/event_listener
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ close: db/marker.manifest.000004.MANIFEST-000011
remove: db/marker.manifest.000003.MANIFEST-000009
sync: db
[JOB 6] MANIFEST created 000011
[JOB 6] compacted(default) L0 [000005 000008] (1.3KB) Score=0.00 + L6 [] (0B) Score=0.00 -> L6 [000010] (653B), in 1.0s (3.0s total), output rate 653B/s
[JOB 6] compacted(default) L0 [000005 000008] (1.3KB) Score=0.00 + L6 [] (0B) Score=0.00 -> L6 [000010] (659B), in 1.0s (3.0s total), output rate 659B/s
close: db/000005.sst
close: db/000008.sst
remove: db/000005.sst
Expand Down Expand Up @@ -186,11 +186,11 @@ remove: db/MANIFEST-000009
ingest
----
open: ext/0
read-at(600, 53): ext/0
read-at(563, 37): ext/0
read-at(116, 447): ext/0
read-at(75, 41): ext/0
read-at(0, 75): ext/0
read-at(606, 53): ext/0
read-at(569, 37): ext/0
read-at(122, 447): ext/0
read-at(81, 41): ext/0
read-at(0, 81): ext/0
close: ext/0
link: ext/0 -> db/000015.sst
[JOB 10] ingesting: sstable created 000015
Expand All @@ -206,21 +206,21 @@ sync: db
remove: db/MANIFEST-000011
[JOB 10] MANIFEST deleted 000011
remove: ext/0
[JOB 10] ingested L0:000015 (653B)
[JOB 10] ingested L0:000015 (659B)

metrics
----
| | | | ingested | moved | written | | amp
level | tables size val-bl vtables | score | in | tables size | tables size | tables size | read | r w
------+-----------------------------+-------+-------+--------------+--------------+--------------+-------+---------
0 | 2 1.3KB 0B 0 | 0.40 | 81B | 1 653B | 0 0B | 3 1.9KB | 0B | 2 24.3
0 | 2 1.3KB 0B 0 | 0.40 | 81B | 1 659B | 0 0B | 3 1.9KB | 0B | 2 24.3
1 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
2 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
3 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
4 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
5 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
6 | 1 653B 0B 0 | - | 1.3KB | 0 0B | 0 0B | 1 653B | 1.3KB | 1 0.5
total | 3 1.9KB 0B 0 | - | 734B | 1 653B | 0 0B | 4 3.3KB | 1.3KB | 3 4.6
6 | 1 659B 0B 0 | - | 1.3KB | 0 0B | 0 0B | 1 659B | 1.3KB | 1 0.5
total | 3 1.9KB 0B 0 | - | 740B | 1 659B | 0 0B | 4 3.3KB | 1.3KB | 3 4.5
-------------------------------------------------------------------------------------------------------------------
WAL: 1 files (0B) in: 48B written: 81B (69% overhead)
Flushes: 3
Expand All @@ -232,7 +232,7 @@ Backing tables: 0 (0B)
Virtual tables: 0 (0B)
Local tables size: 1.9KB
Compression types: snappy: 3
Block cache: 2 entries (120B) hit rate: 0.0%
Block cache: 2 entries (112B) hit rate: 0.0%
Table cache: 0 entries (0B) hit rate: 50.0%
Secondary cache: 0 entries (0B) hit rate: 0.0%
Snapshots: 0 earliest seq num: 0
Expand All @@ -249,18 +249,18 @@ ingest-flushable
----
sync-data: wal/000012.log
open: ext/a
read-at(600, 53): ext/a
read-at(563, 37): ext/a
read-at(116, 447): ext/a
read-at(75, 41): ext/a
read-at(0, 75): ext/a
read-at(606, 53): ext/a
read-at(569, 37): ext/a
read-at(122, 447): ext/a
read-at(81, 41): ext/a
read-at(0, 81): ext/a
close: ext/a
open: ext/b
read-at(600, 53): ext/b
read-at(563, 37): ext/b
read-at(116, 447): ext/b
read-at(75, 41): ext/b
read-at(0, 75): ext/b
read-at(606, 53): ext/b
read-at(569, 37): ext/b
read-at(122, 447): ext/b
read-at(81, 41): ext/b
read-at(0, 81): ext/b
close: ext/b
link: ext/a -> db/000017.sst
[JOB 11] ingesting: sstable created 000017
Expand All @@ -280,7 +280,7 @@ sync: wal
[JOB 13] WAL created 000020
remove: ext/a
remove: ext/b
[JOB 11] ingested as flushable 000017 (653B), 000018 (653B)
[JOB 11] ingested as flushable 000017 (659B), 000018 (659B)
sync-data: wal/000020.log
close: wal/000020.log
create: wal/000021.log
Expand All @@ -303,7 +303,7 @@ close: db/marker.manifest.000007.MANIFEST-000023
remove: db/marker.manifest.000006.MANIFEST-000016
sync: db
[JOB 16] MANIFEST created 000023
[JOB 16] flushed 2 ingested flushables L0:000017 (653B) + L6:000018 (653B) in 1.0s (2.0s total), output rate 1.3KB/s
[JOB 16] flushed 2 ingested flushables L0:000017 (659B) + L6:000018 (659B) in 1.0s (2.0s total), output rate 1.3KB/s
remove: db/MANIFEST-000014
[JOB 16] MANIFEST deleted 000014
[JOB 17] flushing 1 memtable (100B) to L0
Expand All @@ -321,20 +321,20 @@ level | tables size val-bl vtables | score | in | tables size | tables siz
3 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
4 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
5 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
6 | 2 1.3KB 0B 0 | - | 1.3KB | 1 653B | 0 0B | 1 653B | 1.3KB | 1 0.5
total | 6 3.8KB 0B 0 | - | 2.0KB | 3 1.9KB | 0 0B | 5 5.2KB | 1.3KB | 5 2.6
6 | 2 1.3KB 0B 0 | - | 1.3KB | 1 659B | 0 0B | 1 659B | 1.3KB | 1 0.5
total | 6 3.9KB 0B 0 | - | 2.0KB | 3 1.9KB | 0 0B | 5 5.2KB | 1.3KB | 5 2.6
-------------------------------------------------------------------------------------------------------------------
WAL: 1 files (0B) in: 82B written: 108B (32% overhead)
Flushes: 6
Compactions: 1 estimated debt: 3.8KB in progress: 0 (0B)
Compactions: 1 estimated debt: 3.9KB in progress: 0 (0B)
default: 1 delete: 0 elision: 0 move: 0 read: 0 tombstone-density: 0 rewrite: 0 copy: 0 multi-level: 0
MemTables: 1 (512KB) zombie: 1 (512KB)
Zombie tables: 0 (0B, local: 0B)
Backing tables: 0 (0B)
Virtual tables: 0 (0B)
Local tables size: 3.8KB
Local tables size: 3.9KB
Compression types: snappy: 6
Block cache: 6 entries (360B) hit rate: 0.0%
Block cache: 6 entries (336B) hit rate: 0.0%
Table cache: 0 entries (0B) hit rate: 50.0%
Secondary cache: 0 entries (0B) hit rate: 0.0%
Snapshots: 0 earliest seq num: 0
Expand Down
4 changes: 2 additions & 2 deletions testdata/flushable_ingest
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ small-00001-does-not-exist: pebble: not found
get with-fs-logging
large-00001
----
read-at(1161265, 69): 000005.sst
read-at(1161265, 65): 000005.sst
read-at(1155684, 2966): 000005.sst
read-at(0, 2818): 000005.sst
large-00001:val-00001
Expand All @@ -680,7 +680,7 @@ large-00001:val-00001
get with-fs-logging
large-00001-does-not-exist
----
read-at(1161265, 69): 000005.sst
read-at(1161265, 65): 000005.sst
read-at(1155684, 2966): 000005.sst
read-at(0, 2818): 000005.sst
large-00001-does-not-exist: pebble: not found
2 changes: 1 addition & 1 deletion testdata/ingest
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ num-entries: 2
num-deletions: 2
num-range-key-sets: 0
point-deletions-bytes-estimate: 0
range-deletions-bytes-estimate: 1226
range-deletions-bytes-estimate: 1229

# A set operation takes precedence over a range deletion at the same
# sequence number as can occur during ingestion.
Expand Down
8 changes: 4 additions & 4 deletions testdata/ingest_external
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ gi: (foo, .)
lsm verbose
----
L6:
000004(000004):[gc#10,DELSIZED-gf#inf,RANGEDEL] seqnums:[10-10] points:[gc#10,DELSIZED-gf#inf,RANGEDEL] size:1254
000005(000005):[gg#11,DELSIZED-gj#inf,RANGEDEL] seqnums:[11-11] points:[gg#11,DELSIZED-gj#inf,RANGEDEL] size:968
000004(000004):[gc#10,DELSIZED-gf#inf,RANGEDEL] seqnums:[10-10] points:[gc#10,DELSIZED-gf#inf,RANGEDEL] size:1261
000005(000005):[gg#11,DELSIZED-gj#inf,RANGEDEL] seqnums:[11-11] points:[gg#11,DELSIZED-gj#inf,RANGEDEL] size:1016

download g h via-backing-file-download
----
Expand All @@ -341,8 +341,8 @@ ok
lsm verbose
----
L6:
000006(000006):[gc#10,DELSIZED-gf#inf,RANGEDEL] seqnums:[10-10] points:[gc#10,DELSIZED-gf#inf,RANGEDEL] size:874
000007(000007):[gg#11,DELSIZED-gj#inf,RANGEDEL] seqnums:[11-11] points:[gg#11,DELSIZED-gj#inf,RANGEDEL] size:867
000006(000006):[gc#10,DELSIZED-gf#inf,RANGEDEL] seqnums:[10-10] points:[gc#10,DELSIZED-gf#inf,RANGEDEL] size:908
000007(000007):[gg#11,DELSIZED-gj#inf,RANGEDEL] seqnums:[11-11] points:[gg#11,DELSIZED-gj#inf,RANGEDEL] size:916

reopen
----
Expand Down
8 changes: 4 additions & 4 deletions testdata/iterator_stats
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ c: (2, .)
stats: seeked 1 times (1 internal); stepped 0 times (0 internal); blocks: 113B cached; points: 1 (1B keys, 1B values)
d@10: (d10, .)
d@9: (d9, .)
stats: seeked 1 times (1 internal); stepped 2 times (2 internal); blocks: 282B cached, 10B not cached (read time: 0s); points: 3 (8B keys, 6B values); separated: 1 (2B, 2B fetched)
stats: seeked 1 times (1 internal); stepped 2 times (2 internal); blocks: 303B cached, 10B not cached (read time: 0s); points: 3 (8B keys, 6B values); separated: 1 (2B, 2B fetched)
d@8: (d8, .)
stats: seeked 1 times (1 internal); stepped 3 times (3 internal); blocks: 282B cached, 10B not cached (read time: 0s); points: 4 (11B keys, 8B values); separated: 2 (4B, 4B fetched)
stats: seeked 1 times (1 internal); stepped 3 times (3 internal); blocks: 303B cached, 10B not cached (read time: 0s); points: 4 (11B keys, 8B values); separated: 2 (4B, 4B fetched)
e@20: (e20, .)
stats: seeked 1 times (1 internal); stepped 4 times (4 internal); blocks: 282B cached, 10B not cached (read time: 0s); points: 5 (15B keys, 11B values); separated: 2 (4B, 4B fetched)
stats: seeked 1 times (1 internal); stepped 4 times (4 internal); blocks: 303B cached, 10B not cached (read time: 0s); points: 5 (15B keys, 11B values); separated: 2 (4B, 4B fetched)
e@18: (e18, .)
stats: seeked 1 times (1 internal); stepped 5 times (5 internal); blocks: 282B cached, 10B not cached (read time: 0s); points: 6 (19B keys, 13B values); separated: 3 (7B, 7B fetched)
stats: seeked 1 times (1 internal); stepped 5 times (5 internal); blocks: 303B cached, 10B not cached (read time: 0s); points: 6 (19B keys, 13B values); separated: 3 (7B, 7B fetched)
4 changes: 2 additions & 2 deletions testdata/manual_compaction_set_with_del_sstable_Pebblev5
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ num-entries: 1
num-deletions: 1
num-range-key-sets: 0
point-deletions-bytes-estimate: 0
range-deletions-bytes-estimate: 1314
range-deletions-bytes-estimate: 1320

compact a-e L1
----
Expand All @@ -106,7 +106,7 @@ num-entries: 2
num-deletions: 1
num-range-key-sets: 0
point-deletions-bytes-estimate: 0
range-deletions-bytes-estimate: 657
range-deletions-bytes-estimate: 660

# Same as above, except range tombstone covers multiple grandparent file boundaries.

Expand Down
6 changes: 3 additions & 3 deletions testdata/marked_for_compaction
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ L1
L0.0:
000004:[c#11,SET-c#11,SET] seqnums:[11-11] points:[c#11,SET-c#11,SET] size:653
L1:
000005:[c#0,SET-d#0,SET] seqnums:[0-0] points:[c#0,SET-d#0,SET] size:661
000005:[c#0,SET-d#0,SET] seqnums:[0-0] points:[c#0,SET-d#0,SET] size:664

mark-for-compaction file=000005
----
Expand All @@ -20,9 +20,9 @@ marked L0.000004

maybe-compact
----
[JOB 100] compacted(rewrite) L1 [000005] (661B) Score=0.00 + L1 [] (0B) Score=0.00 -> L1 [000006] (661B), in 1.0s (2.0s total), output rate 661B/s
[JOB 100] compacted(rewrite) L1 [000005] (664B) Score=0.00 + L1 [] (0B) Score=0.00 -> L1 [000006] (664B), in 1.0s (2.0s total), output rate 664B/s
[JOB 100] compacted(rewrite) L0 [000004] (653B) Score=0.00 + L0 [] (0B) Score=0.00 -> L0 [000007] (653B), in 1.0s (2.0s total), output rate 653B/s
L0.0:
000007:[c#11,SET-c#11,SET] seqnums:[11-11] points:[c#11,SET-c#11,SET] size:653
L1:
000006:[c#0,SET-d#0,SET] seqnums:[0-0] points:[c#0,SET-d#0,SET] size:661
000006:[c#0,SET-d#0,SET] seqnums:[0-0] points:[c#0,SET-d#0,SET] size:664
Loading

0 comments on commit 8989e4e

Please sign in to comment.