Skip to content

Commit feb3805

Browse files
committed
storage: add blob-rewrite compaction cluster settings
Add two new cluster settings for configuring blob-rewrite compactions. Epic: CRDB-20379 Release note (ops change): Add cluster settings for configuring blob file rewrite compactions.
1 parent 5fdffb3 commit feb3805

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

pkg/storage/pebble.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,21 @@ var (
374374
int64(metamorphic.ConstantWithTestRange("storage.value_separation.max_reference_depth", 10 /* default */, 2, 20)),
375375
settings.IntWithMinimum(2),
376376
)
377+
valueSeparationRewriteMinimumAge = settings.RegisterDurationSetting(
378+
settings.SystemVisible,
379+
"storage.value_separation.rewrite_minimum_age",
380+
"the minimum age of a blob file before it is eligible for a rewrite compaction",
381+
5*time.Minute, // 5 minutes
382+
settings.DurationWithMinimum(0),
383+
)
384+
valueSeparationCompactionGarbageThreshold = settings.RegisterIntSetting(
385+
settings.SystemVisible,
386+
"storage.value_separation.compaction_garbage_threshold",
387+
"the max garbage threshold configures the percentage of unreferenced value "+
388+
"bytes that trigger blob-file rewrite compactions; 100 disables these compactions",
389+
100, /* default; disables blob-file rewrites */
390+
settings.IntInRange(1, 100),
391+
)
377392
)
378393

379394
// EngineComparer is a pebble.Comparer object that implements MVCC-specific
@@ -848,8 +863,8 @@ func newPebble(ctx context.Context, cfg engineConfig) (p *Pebble, err error) {
848863
Enabled: true,
849864
MinimumSize: int(valueSeparationMinimumSize.Get(&cfg.settings.SV)),
850865
MaxBlobReferenceDepth: int(valueSeparationMaxReferenceDepth.Get(&cfg.settings.SV)),
851-
RewriteMinimumAge: time.Minute,
852-
TargetGarbageRatio: 1.0, // Disable blob file rewrites
866+
RewriteMinimumAge: valueSeparationRewriteMinimumAge.Get(&cfg.settings.SV),
867+
TargetGarbageRatio: float64(valueSeparationCompactionGarbageThreshold.Get(&cfg.settings.SV)) / 100.0,
853868
}
854869
}
855870

0 commit comments

Comments
 (0)