@@ -1056,8 +1056,8 @@ type Options struct {
10561056 // This value is only a best-effort target; the effective rate can be
10571057 // higher if deletions are falling behind or disk space is running low.
10581058 //
1059- // Setting this to 0 disables deletion pacing, which is also the default.
1060- TargetByteDeletionRate int
1059+ // A returned value of 0 disables deletion pacing (this is also the default) .
1060+ TargetByteDeletionRate func () int
10611061
10621062 // FreeSpaceThresholdBytes specifies the minimum amount of free disk space that Pebble
10631063 // attempts to maintain. If free disk space drops below this threshold, deletions
@@ -1166,6 +1166,10 @@ func (o *Options) EnsureDefaults() {
11661166 o .Cleaner = DeleteCleaner {}
11671167 }
11681168
1169+ if o .TargetByteDeletionRate == nil {
1170+ o .TargetByteDeletionRate = func () int { return 0 }
1171+ }
1172+
11691173 if o .FreeSpaceThresholdBytes == 0 {
11701174 o .FreeSpaceThresholdBytes = 16 << 30 // 16 GB
11711175 }
@@ -1444,7 +1448,7 @@ func (o *Options) String() string {
14441448 fmt .Fprintf (& buf , " max_open_files=%d\n " , o .MaxOpenFiles )
14451449 fmt .Fprintf (& buf , " mem_table_size=%d\n " , o .MemTableSize )
14461450 fmt .Fprintf (& buf , " mem_table_stop_writes_threshold=%d\n " , o .MemTableStopWritesThreshold )
1447- fmt .Fprintf (& buf , " min_deletion_rate=%d\n " , o .TargetByteDeletionRate )
1451+ fmt .Fprintf (& buf , " min_deletion_rate=%d\n " , o .TargetByteDeletionRate () )
14481452 fmt .Fprintf (& buf , " free_space_threshold_bytes=%d\n " , o .FreeSpaceThresholdBytes )
14491453 fmt .Fprintf (& buf , " free_space_timeframe=%s\n " , o .FreeSpaceTimeframe .String ())
14501454 fmt .Fprintf (& buf , " obsolete_bytes_max_ratio=%f\n " , o .ObsoleteBytesMaxRatio )
@@ -1789,7 +1793,11 @@ func (o *Options) Parse(s string, hooks *ParseHooks) error {
17891793 // Do nothing; option existed in older versions of pebble, and
17901794 // may be meaningful again eventually.
17911795 case "min_deletion_rate" :
1792- o .TargetByteDeletionRate , err = strconv .Atoi (value )
1796+ var rate int
1797+ rate , err = strconv .Atoi (value )
1798+ if err == nil {
1799+ o .TargetByteDeletionRate = func () int { return rate }
1800+ }
17931801 case "free_space_threshold_bytes" :
17941802 o .FreeSpaceThresholdBytes , err = strconv .ParseUint (value , 10 , 64 )
17951803 case "free_space_timeframe" :
0 commit comments