@@ -1238,6 +1238,13 @@ type ValueSeparationPolicy struct {
12381238 //
12391239 // MinimumSize must be > 0.
12401240 MinimumSize int
1241+ // MinimumMVCCGarbageSize specifies the minimum size of a value that can be
1242+ // separated into a blob file if said value is likely MVCC garbage. This
1243+ // applies only to SpanPolicies that permit separation of MVCC garbage,
1244+ // which is also the default.
1245+ //
1246+ // MinimumMVCCGarbageSize must be > 0.
1247+ MinimumMVCCGarbageSize int
12411248 // MaxBlobReferenceDepth limits the number of potentially overlapping (in
12421249 // the keyspace) blob files that can be referenced by a single sstable. If a
12431250 // compaction may produce an output sstable referencing more than this many
@@ -1311,36 +1318,51 @@ func (p SpanPolicy) String() string {
13111318 if p .DisableValueSeparationBySuffix {
13121319 sb .WriteString ("disable-value-separation-by-suffix," )
13131320 }
1314- switch p .ValueStoragePolicy {
1315- case ValueStorageLowReadLatency :
1316- sb .WriteString ("low-read-latency ," )
1317- case ValueStorageLatencyTolerant :
1318- sb .WriteString ("latency-tolerant ," )
1321+ switch p .ValueStoragePolicy . PolicyAdjustment {
1322+ case NoValueSeparation :
1323+ sb .WriteString ("no-value-separation ," )
1324+ case Override :
1325+ sb .WriteString ("override ," )
13191326 }
13201327 return strings .TrimSuffix (sb .String (), "," )
13211328}
13221329
1323- // ValueStoragePolicy is a hint used to determine where to store the values for
1324- // KVs.
1325- type ValueStoragePolicy uint8
1330+ // ValueStoragePolicy is used to determine where to store the values for
1331+ // KVs. If the PolicyAdjustment specified is Override, the remaining fields
1332+ // are used to override the global configuration for value separation.
1333+ type ValueStoragePolicy struct {
1334+ // PolicyAdjustment specifies the policy adjustment to apply.
1335+ PolicyAdjustment ValueStoragePolicyAdjustment
1336+ // Remaining fields are ignored, unless the PolicyAdjustment is Override.
1337+
1338+ // MinimumSize is the minimum size of the value.
1339+ MinimumSize int
1340+ // MinimumMVCCGarbageSize is the minimum size of the value that is likely
1341+ // MVCC garbage.
1342+ MinimumMVCCGarbageSize int
1343+ }
1344+
1345+ // ValueStoragePolicyAdjustment is a hint used to determine where to store the
1346+ // values for KVs.
1347+ type ValueStoragePolicyAdjustment uint8
13261348
13271349const (
1328- // ValueStorageDefault is the default value; Pebble will respect global
1329- // configuration for value blocks and value separation.
1330- ValueStorageDefault ValueStoragePolicy = iota
1350+ // UseDefault is the default value; Pebble will respect global
1351+ // configuration for value separation.
1352+ UseDefault ValueStoragePolicyAdjustment = iota
13311353
1332- // ValueStorageLowReadLatency indicates Pebble should prefer storing values
1354+ // NoValueSeparation indicates Pebble should prefer storing values
13331355 // in-place.
1334- ValueStorageLowReadLatency
1356+ NoValueSeparation
13351357
1336- // ValueStorageLatencyTolerant indicates value retrieval can tolerate
1358+ // Override indicates value retrieval can tolerate
13371359 // additional latency, so Pebble should aggressively prefer storing values
13381360 // separately if it can reduce write amplification.
13391361 //
13401362 // If the global Options' enable value separation, Pebble may choose to
1341- // separate values under the LatencyTolerant policy even if they do not meet
1363+ // separate values under the Override policy even if they do not meet
13421364 // the minimum size threshold of the global Options' ValueSeparationPolicy.
1343- ValueStorageLatencyTolerant
1365+ Override
13441366)
13451367
13461368// SpanPolicyFunc is used to determine the SpanPolicy for a key region.
@@ -1855,6 +1877,7 @@ func (o *Options) String() string {
18551877 fmt .Fprintln (& buf , "[Value Separation]" )
18561878 fmt .Fprintf (& buf , " enabled=%t\n " , policy .Enabled )
18571879 fmt .Fprintf (& buf , " minimum_size=%d\n " , policy .MinimumSize )
1880+ fmt .Fprintf (& buf , " minimum_mvcc_garbage_size=%d\n " , policy .MinimumMVCCGarbageSize )
18581881 fmt .Fprintf (& buf , " max_blob_reference_depth=%d\n " , policy .MaxBlobReferenceDepth )
18591882 fmt .Fprintf (& buf , " rewrite_minimum_age=%s\n " , policy .RewriteMinimumAge )
18601883 fmt .Fprintf (& buf , " garbage_ratio_low_priority=%.2f\n " , policy .GarbageRatioLowPriority )
@@ -2300,6 +2323,10 @@ func (o *Options) Parse(s string, hooks *ParseHooks) error {
23002323 var minimumSize int
23012324 minimumSize , err = strconv .Atoi (value )
23022325 valSepPolicy .MinimumSize = minimumSize
2326+ case "minimum_mvcc_garbage_size" :
2327+ var minimumMVCCGarbageSize int
2328+ minimumMVCCGarbageSize , err = strconv .Atoi (value )
2329+ valSepPolicy .MinimumMVCCGarbageSize = minimumMVCCGarbageSize
23032330 case "max_blob_reference_depth" :
23042331 valSepPolicy .MaxBlobReferenceDepth , err = strconv .Atoi (value )
23052332 case "rewrite_minimum_age" :
@@ -2571,6 +2598,9 @@ func (o *Options) Validate() error {
25712598 if policy .MinimumSize <= 0 {
25722599 fmt .Fprintf (& buf , "ValueSeparationPolicy.MinimumSize (%d) must be > 0\n " , policy .MinimumSize )
25732600 }
2601+ if policy .MinimumMVCCGarbageSize <= 0 {
2602+ fmt .Fprintf (& buf , "ValueSeparationPolicy.MinimumMVCCGarbageSize (%d) must be > 0\n " , policy .MinimumMVCCGarbageSize )
2603+ }
25742604 if policy .MaxBlobReferenceDepth <= 0 {
25752605 fmt .Fprintf (& buf , "ValueSeparationPolicy.MaxBlobReferenceDepth (%d) must be > 0\n " , policy .MaxBlobReferenceDepth )
25762606 }
0 commit comments