@@ -1297,70 +1297,64 @@ func (p SpanPolicy) String() string {
12971297 if p .ValueStoragePolicy .DisableSeparationBySuffix {
12981298 sb .WriteString ("disable-value-separation-by-suffix," )
12991299 }
1300- switch p .ValueStoragePolicy .PolicyAdjustment {
1301- case NoValueSeparation :
1302- sb . WriteString ( "no-value-separation," )
1303- case OverrideValueStorage :
1304- sb .WriteString ("override, " )
1300+ if p .ValueStoragePolicy .DisableBlobSeparation {
1301+ sb . WriteString ( "no-blob-value-separation," )
1302+ }
1303+ if p . ValueStoragePolicy . OverrideBlobSeparationMinimumSize > 0 {
1304+ sb .WriteString ("override-value-separation-min-size " )
13051305 }
13061306 return strings .TrimSuffix (sb .String (), "," )
13071307}
13081308
13091309// ValueStoragePolicyAdjustment is used to determine where to store the values for
1310- // KVs. If the PolicyAdjustment specified is OverrideValueStorage, the remaining fields
1311- // are used to override the global configuration for value separation .
1310+ // KVs, overriding global policies. Values can be configured to be stored in-place,
1311+ // in value blocks, or in blob files .
13121312type ValueStoragePolicyAdjustment struct {
1313- // PolicyAdjustment specifies the policy adjustment to apply.
1314- PolicyAdjustment ValueStoragePolicyAdjustmentType
1315-
1316- // Remaining fields are ignored, unless the PolicyAdjustment is OverrideValueStorage.
1317-
13181313 // DisableSeparationBySuffix disables discriminating KVs depending on
13191314 // suffix.
13201315 //
13211316 // Among a set of keys with the same prefix, Pebble's default heuristics
13221317 // optimize access to the KV with the smallest suffix. This is useful for MVCC
13231318 // keys (where the smallest suffix is the latest version), but should be
13241319 // disabled for keys where the suffix does not correspond to a version.
1320+ // See sstable.IsLikelyMVCCGarbage for the exact criteria we use to
1321+ // determine whether a value is likely MVCC garbage.
1322+ //
1323+ // If separation by suffix is enabled, KVs with older suffix values will be
1324+ // written according to the following rules:
1325+ // - If the value is empty, no separation is performed.
1326+ // - If blob separation is enabled the value will be separated into a blob
1327+ // file even if its size is smaller than the minimum value size.
1328+ // - If blob separation is disabled, the value will be written to a value
1329+ // block within the sstable.
1330+ // - Otherwise, the KV will be subject to regular value separation rules.
13251331 DisableSeparationBySuffix bool
1326- // MinimumSize is the minimum size of the value.
1327- MinimumSize int
1328- }
13291332
1330- // ValueStoragePolicyAdjustmentType is a hint used to determine where to store the
1331- // values for KVs.
1332- type ValueStoragePolicyAdjustmentType uint8
1333+ // DisableBlobSeparation disables separating values into blob files.
1334+ DisableBlobSeparation bool
13331335
1334- const (
1335- // UseDefaultValueStorage is the default value; Pebble will respect global
1336- // configuration for value separation.
1337- UseDefaultValueStorage ValueStoragePolicyAdjustmentType = iota
1338-
1339- // NoValueSeparation indicates Pebble should prefer storing values
1340- // in-place.
1341- NoValueSeparation
1342-
1343- // OverrideValueStorage indicates that value separation thresholds (see
1344- // valsep.ValueSeparationOutputConfig) for this key range are being
1345- // overridden from a SpanPolicy. If the global Options enable value
1346- // separation, Pebble will separate values under the OverrideValueStorage
1347- // policy even if they do not meet the minimum size threshold of the
1348- // global Options' ValueSeparationPolicy.
1349- OverrideValueStorage
1350- )
1336+ // OverrideBlobSeparationMinimumSize overrides the minimum size required
1337+ // for value separation into a blob file. Note that value separation must
1338+ // be enabled globally for this to take effect.
1339+ OverrideBlobSeparationMinimumSize int
1340+ }
1341+
1342+ func (vsp * ValueStoragePolicyAdjustment ) ContainsOverrides () bool {
1343+ return vsp .OverrideBlobSeparationMinimumSize > 0 || vsp .DisableSeparationBySuffix
1344+ }
13511345
13521346// ValueStorageLatencyTolerant is the suggested ValueStoragePolicyAdjustment
13531347// to use for key ranges that can tolerate higher value retrieval
13541348// latency.
13551349var ValueStorageLatencyTolerant = ValueStoragePolicyAdjustment {
1356- PolicyAdjustment : OverrideValueStorage ,
1357- MinimumSize : 10 ,
1350+ OverrideBlobSeparationMinimumSize : 10 ,
13581351}
13591352
13601353// ValueStorageLowReadLatency is the suggested ValueStoragePolicyAdjustment
13611354// to use for key ranges that require low value retrieval latency.
13621355var ValueStorageLowReadLatency = ValueStoragePolicyAdjustment {
1363- PolicyAdjustment : NoValueSeparation ,
1356+ DisableBlobSeparation : true ,
1357+ DisableSeparationBySuffix : true ,
13641358}
13651359
13661360// SpanPolicyFunc is used to determine the SpanPolicy for a key region.
0 commit comments