Skip to content

Commit a00d8f0

Browse files
committed
storage: add cluster setting to use old compaction eligibility
In cockroachdb/pebble#5187 we altered the default compaction picking logic that determines whether a level is elgible for a default compaction. We added a knob to allow the configuration of this value at runtime in case the change has some unforeseen impact on some workloads. This commit connects this knob to a new cluster setting. This cluster setting is just an escape hatch that we don't anticipate needing. Epic: none Release note: none
1 parent 6cabe06 commit a00d8f0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pkg/storage/pebble.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,22 @@ var UnhealthyWriteDuration = settings.RegisterDurationSetting(
198198
20*time.Second,
199199
settings.WithPublic)
200200

201+
// useDeprecatedCompensatedScore is a temporary setting that provides a
202+
// mechanism for reverting Pebble's compaction picking heuristic to the previous
203+
// (25.3 and earlier) behavior for deciding when a level is eligible for
204+
// compaction. See the pebble.Options Experimental UseDeprecatedCompensatedScore
205+
// setting for details.
206+
//
207+
// We anticipate not needing to use this setting, but it's provided as an escape
208+
// hatch in case the heuristic change has an unforeseen impact on some
209+
// workloads.
210+
var useDeprecatedCompensatedScore = settings.RegisterBoolSetting(
211+
settings.ApplicationLevel,
212+
"storage.deprecated_compensated_score.enabled",
213+
"if enabled, this setting reverts the storage engine's compaction picking heuristic",
214+
false,
215+
)
216+
201217
// SSTableCompressionProfile is an enumeration of compression algorithms
202218
// available for compressing SSTables (e.g. for backup or transport).
203219
type SSTableCompressionProfile int64
@@ -946,6 +962,11 @@ func newPebble(ctx context.Context, cfg engineConfig) (p *Pebble, err error) {
946962
cfg.opts.TargetByteDeletionRate = func() int {
947963
return int(baselineDeletionRate.Get(&cfg.settings.SV))
948964
}
965+
if cfg.opts.Experimental.UseDeprecatedCompensatedScore == nil {
966+
cfg.opts.Experimental.UseDeprecatedCompensatedScore = func() bool {
967+
return useDeprecatedCompensatedScore.Get(&cfg.settings.SV)
968+
}
969+
}
949970

950971
cfg.opts.EnsureDefaults()
951972

0 commit comments

Comments
 (0)