Skip to content

Commit 4facf2f

Browse files
committed
storage: add cluster setting for delete pacer
Add a (private) cluster setting that controls the baseline delete pacing rate. Informs: cockroachdb/pebble#5424 Release note: None
1 parent 44db6c2 commit 4facf2f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

pkg/storage/pebble.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,17 @@ var (
492492
)
493493
)
494494

495+
// This setting controls deletion pacing. This helps prevent disk slowness
496+
// events on some SSDs, that kick off an expensive GC if a lot of files are
497+
// deleted at once.
498+
var baselineDeletionRate = settings.RegisterIntSetting(
499+
settings.ApplicationLevel,
500+
"storage.baseline_deletion_rate",
501+
"the baseline allowed rate of bytes deleted per second by each store",
502+
128*1024*1024, // 128 MB/s
503+
settings.NonNegativeInt,
504+
)
505+
495506
// EngineComparer is a pebble.Comparer object that implements MVCC-specific
496507
// comparator settings for use with Pebble.
497508
var EngineComparer = func() pebble.Comparer {
@@ -573,10 +584,6 @@ func DefaultPebbleOptions() *pebble.Options {
573584
// This ensures that range keys are quickly flushed, allowing use of lazy
574585
// combined iteration within Pebble.
575586
opts.FlushDelayRangeKey = 10 * time.Second
576-
// Enable deletion pacing. This helps prevent disk slowness events on some
577-
// SSDs, that kick off an expensive GC if a lot of files are deleted at
578-
// once.
579-
opts.TargetByteDeletionRate = 128 << 20 // 128 MB
580587
opts.Experimental.ShortAttributeExtractor = shortAttributeExtractorForValues
581588

582589
opts.Experimental.SpanPolicyFunc = spanPolicyFunc
@@ -931,6 +938,9 @@ func newPebble(ctx context.Context, cfg engineConfig) (p *Pebble, err error) {
931938
return int(concurrentDownloadCompactions.Get(&cfg.settings.SV))
932939
}
933940
}
941+
cfg.opts.TargetByteDeletionRate = func() int {
942+
return int(baselineDeletionRate.Get(&cfg.settings.SV))
943+
}
934944

935945
cfg.opts.EnsureDefaults()
936946

0 commit comments

Comments
 (0)