Skip to content

Commit 95d9475

Browse files
committed
storage: add storage.value_separation.compaction_garbage_threshold_high_priority
Add a new cluster setting for configuring high-priority blob file rewrite compactions. One of these compactions is allowed to run ahead of a default compaction if the amount of garbage exceeds the configured percentage. Epic: none Release note: none
1 parent cf40b97 commit 95d9475

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

pkg/storage/pebble.go

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,12 +452,21 @@ var (
452452
settings.SystemVisible,
453453
"storage.value_separation.compaction_garbage_threshold",
454454
"the max garbage threshold configures the percentage of unreferenced value "+
455-
"bytes that trigger blob-file rewrite compactions; 100 disables these compactions",
455+
"bytes that begin to trigger blob-file rewrite compactions; 100 disables these compactions",
456456
int64(metamorphic.ConstantWithTestRange("storage.value_separation.compaction_garbage_threshold",
457457
10, /* default */
458458
1 /* min */, 80 /* max */)),
459459
settings.IntInRange(1, 100),
460460
)
461+
valueSeparationCompactionGarbageThresholdHighPriority = settings.RegisterIntSetting(
462+
settings.SystemVisible,
463+
"storage.value_separation.compaction_garbage_threshold_high_priority",
464+
"configures the percentage of unreferenced value bytes that trigger high-priority blob-file rewrite compactions",
465+
int64(metamorphic.ConstantWithTestRange("storage.value_separation.compaction_garbage_threshold",
466+
20, /* default */
467+
1 /* min */, 80 /* max */)),
468+
settings.IntInRange(1, 100),
469+
)
461470
)
462471

463472
// EngineComparer is a pebble.Comparer object that implements MVCC-specific
@@ -936,12 +945,16 @@ func newPebble(ctx context.Context, cfg engineConfig) (p *Pebble, err error) {
936945
if !valueSeparationEnabled.Get(&cfg.settings.SV) {
937946
return pebble.ValueSeparationPolicy{}
938947
}
948+
lowPri := float64(valueSeparationCompactionGarbageThreshold.Get(&cfg.settings.SV)) / 100.0
949+
highPri := float64(valueSeparationCompactionGarbageThresholdHighPriority.Get(&cfg.settings.SV)) / 100.0
950+
highPri = max(highPri, lowPri)
939951
return pebble.ValueSeparationPolicy{
940-
Enabled: true,
941-
MinimumSize: int(valueSeparationMinimumSize.Get(&cfg.settings.SV)),
942-
MaxBlobReferenceDepth: int(valueSeparationMaxReferenceDepth.Get(&cfg.settings.SV)),
943-
RewriteMinimumAge: valueSeparationRewriteMinimumAge.Get(&cfg.settings.SV),
944-
TargetGarbageRatio: float64(valueSeparationCompactionGarbageThreshold.Get(&cfg.settings.SV)) / 100.0,
952+
Enabled: true,
953+
MinimumSize: int(valueSeparationMinimumSize.Get(&cfg.settings.SV)),
954+
MaxBlobReferenceDepth: int(valueSeparationMaxReferenceDepth.Get(&cfg.settings.SV)),
955+
RewriteMinimumAge: valueSeparationRewriteMinimumAge.Get(&cfg.settings.SV),
956+
GarbageRatioLowPriority: lowPri,
957+
GarbageRatioHighPriority: highPri,
945958
}
946959
}
947960
cfg.opts.Experimental.MultiLevelCompactionHeuristic = func() pebble.MultiLevelHeuristic {

0 commit comments

Comments
 (0)