Skip to content

Commit 6a19851

Browse files
committed
storage: add value separation cluster settings
Add new cluster settings for enabling and configuring value separation. Close #147709. Epic: CRDB-20379 Release note (ops change): Introduces new cluster settings for enabling the preview feature of value separation.
1 parent 0be36a1 commit 6a19851

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

pkg/storage/pebble.go

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,33 @@ var concurrentDownloadCompactions = settings.RegisterIntSetting(
348348
settings.IntWithMinimum(1),
349349
)
350350

351+
var (
352+
valueSeparationEnabled = settings.RegisterBoolSetting(
353+
settings.SystemVisible,
354+
"storage.value_separation.enabled",
355+
"(experimental) whether or not values may be separated into blob files; "+
356+
"requires columnar blocks to be enabled",
357+
metamorphic.ConstantWithTestBool(
358+
"storage.value_separation.enabled", false), /* defaultValue */
359+
)
360+
valueSeparationMinimumSize = settings.RegisterIntSetting(
361+
settings.SystemVisible,
362+
"storage.value_separation.minimum_size",
363+
"the minimum size of a value that will be separated into a blob file",
364+
int64(metamorphic.ConstantWithTestRange("storage.value_separation.minimum_size",
365+
1<<10 /* 1 KiB (default) */, 25 /* 25 bytes (minimum) */, 1<<20 /* 1 MiB (maximum) */)),
366+
settings.IntWithMinimum(1),
367+
)
368+
valueSeparationMaxReferenceDepth = settings.RegisterIntSetting(
369+
settings.SystemVisible,
370+
"storage.value_separation.max_reference_depth",
371+
"the max reference depth bounds the number of unique, overlapping blob files referenced within a sstable;"+
372+
" lower values improve scan performance but increase write amplification",
373+
int64(metamorphic.ConstantWithTestRange("storage.value_separation.max_reference_depth", 10 /* default */, 2, 20)),
374+
settings.IntWithMinimum(2),
375+
)
376+
)
377+
351378
// EngineComparer is a pebble.Comparer object that implements MVCC-specific
352379
// comparator settings for use with Pebble.
353380
var EngineComparer = func() pebble.Comparer {
@@ -452,7 +479,6 @@ func DefaultPebbleOptions() *pebble.Options {
452479
// for why this was disabled, and what needs to be changed to reenable it.
453480
// This issue tracks re-enablement: https://github.com/cockroachdb/pebble/issues/4139
454481
opts.Experimental.MultiLevelCompactionHeuristic = pebble.NoMultiLevel{}
455-
456482
opts.Experimental.UserKeyCategories = userKeyCategories
457483

458484
opts.Levels[0] = pebble.LevelOptions{
@@ -801,6 +827,16 @@ func newPebble(ctx context.Context, cfg engineConfig) (p *Pebble, err error) {
801827
cfg.opts.Experimental.EnableDeleteOnlyCompactionExcises = func() bool {
802828
return deleteCompactionsCanExcise.Get(&cfg.settings.SV)
803829
}
830+
cfg.opts.Experimental.ValueSeparationPolicy = func() pebble.ValueSeparationPolicy {
831+
if !valueSeparationEnabled.Get(&cfg.settings.SV) {
832+
return pebble.ValueSeparationPolicy{}
833+
}
834+
return pebble.ValueSeparationPolicy{
835+
Enabled: true,
836+
MinimumSize: int(valueSeparationMinimumSize.Get(&cfg.settings.SV)),
837+
MaxBlobReferenceDepth: int(valueSeparationMaxReferenceDepth.Get(&cfg.settings.SV)),
838+
}
839+
}
804840

805841
auxDir := cfg.opts.FS.PathJoin(cfg.env.Dir, base.AuxiliaryDir)
806842
if !cfg.env.IsReadOnly() {

0 commit comments

Comments
 (0)