Skip to content

Commit 79e6b4a

Browse files
committed
db: add DBCompressionFast
Add `DBCompressionSettings` that uses `FastCompression` on L6 (which automatically chooses between MinLZ or Zstd1 for value blocks).
1 parent 3795809 commit 79e6b4a

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

metamorphic/options.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,7 @@ func RandomOptions(rng *rand.Rand, kf KeyFormat, cfg RandomOptionsCfg) *TestOpti
827827
if rng.IntN(2) == 0 {
828828
csList := []pebble.DBCompressionSettings{
829829
pebble.DBCompressionNone,
830+
pebble.DBCompressionFast,
830831
pebble.DBCompressionFastest,
831832
pebble.DBCompressionBalanced,
832833
pebble.DBCompressionGood,

options.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,24 +1445,32 @@ type DBCompressionSettings struct {
14451445

14461446
// Predefined compression settings.
14471447
var (
1448-
DBCompressionNone = UniformDBCompressionSettings(block.NoCompression)
1449-
DBCompressionFastest = UniformDBCompressionSettings(block.FastestCompression)
1448+
DBCompressionNone = UniformDBCompressionSettings(block.NoCompression)
1449+
DBCompressionFastest = UniformDBCompressionSettings(block.FastestCompression)
1450+
DBCompressionFast = func() DBCompressionSettings {
1451+
cs := DBCompressionSettings{Name: "Fast"}
1452+
for i := 0; i < manifest.NumLevels-1; i++ {
1453+
cs.Levels[i] = block.FastestCompression
1454+
}
1455+
cs.Levels[manifest.NumLevels-1] = block.FastCompression
1456+
return cs
1457+
}()
14501458
DBCompressionBalanced = func() DBCompressionSettings {
14511459
cs := DBCompressionSettings{Name: "Balanced"}
14521460
for i := 0; i < manifest.NumLevels-2; i++ {
14531461
cs.Levels[i] = block.FastestCompression
14541462
}
1455-
cs.Levels[manifest.NumLevels-2] = block.FastCompression // Zstd1 for value blocks.
1456-
cs.Levels[manifest.NumLevels-1] = block.BalancedCompression // Zstd1 for data and value blocks.
1463+
cs.Levels[manifest.NumLevels-2] = block.FastCompression
1464+
cs.Levels[manifest.NumLevels-1] = block.BalancedCompression
14571465
return cs
14581466
}()
14591467
DBCompressionGood = func() DBCompressionSettings {
14601468
cs := DBCompressionSettings{Name: "Good"}
14611469
for i := 0; i < manifest.NumLevels-2; i++ {
14621470
cs.Levels[i] = block.FastestCompression
14631471
}
1464-
cs.Levels[manifest.NumLevels-2] = block.BalancedCompression // Zstd1 for data and value blocks.
1465-
cs.Levels[manifest.NumLevels-1] = block.GoodCompression // Zstd3 for data and value blocks.
1472+
cs.Levels[manifest.NumLevels-2] = block.BalancedCompression
1473+
cs.Levels[manifest.NumLevels-1] = block.GoodCompression
14661474
return cs
14671475
}()
14681476
)

0 commit comments

Comments
 (0)