Skip to content

Commit 1b23a41

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 8f3cd19 commit 1b23a41

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
@@ -338,6 +338,17 @@ var concurrentDownloadCompactions = settings.RegisterIntSetting(
338338
settings.IntWithMinimum(1),
339339
)
340340

341+
// This setting controls deletion pacing. This helps prevent disk slowness
342+
// events on some SSDs, that kick off an expensive GC if a lot of files are
343+
// deleted at once.
344+
var baselineDeletionRate = settings.RegisterIntSetting(
345+
settings.ApplicationLevel,
346+
"storage.baseline_deletion_rate",
347+
"the baseline allowed rate of bytes deleted per second by each store",
348+
128*1024*1024, // 128 MB/s
349+
settings.NonNegativeInt,
350+
)
351+
341352
// EngineComparer is a pebble.Comparer object that implements MVCC-specific
342353
// comparator settings for use with Pebble.
343354
var EngineComparer = func() pebble.Comparer {
@@ -423,10 +434,6 @@ func DefaultPebbleOptions() *pebble.Options {
423434
// This ensures that range keys are quickly flushed, allowing use of lazy
424435
// combined iteration within Pebble.
425436
opts.FlushDelayRangeKey = 10 * time.Second
426-
// Enable deletion pacing. This helps prevent disk slowness events on some
427-
// SSDs, that kick off an expensive GC if a lot of files are deleted at
428-
// once.
429-
opts.TargetByteDeletionRate = 128 << 20 // 128 MB
430437
opts.Experimental.ShortAttributeExtractor = shortAttributeExtractorForValues
431438
opts.Experimental.RequiredInPlaceValueBound = pebble.UserKeyPrefixBound{
432439
Lower: EncodeMVCCKey(MVCCKey{Key: keys.LocalRangeLockTablePrefix}),
@@ -735,6 +742,9 @@ func newPebble(ctx context.Context, cfg engineConfig) (p *Pebble, err error) {
735742
return int(concurrentDownloadCompactions.Get(&cfg.settings.SV))
736743
}
737744
}
745+
cfg.opts.TargetByteDeletionRate = func() int {
746+
return int(baselineDeletionRate.Get(&cfg.settings.SV))
747+
}
738748

739749
cfg.opts.EnsureDefaults()
740750

0 commit comments

Comments
 (0)