@@ -348,6 +348,33 @@ var concurrentDownloadCompactions = settings.RegisterIntSetting(
348
348
settings .IntWithMinimum (1 ),
349
349
)
350
350
351
+ var (
352
+ valueSeparationEnabled = settings .RegisterBoolSetting (
353
+ settings .SystemVisible ,
354
+ "storage.value_separation.enabled" ,
355
+ "(experimental) whether or not values may be separated into blob files; " +
356
+ "requires columnar blocks to be enabled" ,
357
+ metamorphic .ConstantWithTestBool (
358
+ "storage.value_separation.enabled" , false ), /* defaultValue */
359
+ )
360
+ valueSeparationMinimumSize = settings .RegisterIntSetting (
361
+ settings .SystemVisible ,
362
+ "storage.value_separation.minimum_size" ,
363
+ "the minimum size of a value that will be separated into a blob file" ,
364
+ int64 (metamorphic .ConstantWithTestRange ("storage.value_separation.minimum_size" ,
365
+ 1 << 10 /* 1 KiB (default) */ , 25 /* 25 bytes (minimum) */ , 1 << 20 /* 1 MiB (maximum) */ )),
366
+ settings .IntWithMinimum (1 ),
367
+ )
368
+ valueSeparationMaxReferenceDepth = settings .RegisterIntSetting (
369
+ settings .SystemVisible ,
370
+ "storage.value_separation.max_reference_depth" ,
371
+ "the max reference depth bounds the number of unique, overlapping blob files referenced within a sstable;" +
372
+ " lower values improve scan performance but increase write amplification" ,
373
+ int64 (metamorphic .ConstantWithTestRange ("storage.value_separation.max_reference_depth" , 10 /* default */ , 2 , 20 )),
374
+ settings .IntWithMinimum (2 ),
375
+ )
376
+ )
377
+
351
378
// EngineComparer is a pebble.Comparer object that implements MVCC-specific
352
379
// comparator settings for use with Pebble.
353
380
var EngineComparer = func () pebble.Comparer {
@@ -452,7 +479,6 @@ func DefaultPebbleOptions() *pebble.Options {
452
479
// for why this was disabled, and what needs to be changed to reenable it.
453
480
// This issue tracks re-enablement: https://github.com/cockroachdb/pebble/issues/4139
454
481
opts .Experimental .MultiLevelCompactionHeuristic = pebble.NoMultiLevel {}
455
-
456
482
opts .Experimental .UserKeyCategories = userKeyCategories
457
483
458
484
opts .Levels [0 ] = pebble.LevelOptions {
@@ -801,6 +827,16 @@ func newPebble(ctx context.Context, cfg engineConfig) (p *Pebble, err error) {
801
827
cfg .opts .Experimental .EnableDeleteOnlyCompactionExcises = func () bool {
802
828
return deleteCompactionsCanExcise .Get (& cfg .settings .SV )
803
829
}
830
+ cfg .opts .Experimental .ValueSeparationPolicy = func () pebble.ValueSeparationPolicy {
831
+ if ! valueSeparationEnabled .Get (& cfg .settings .SV ) {
832
+ return pebble.ValueSeparationPolicy {}
833
+ }
834
+ return pebble.ValueSeparationPolicy {
835
+ Enabled : true ,
836
+ MinimumSize : int (valueSeparationMinimumSize .Get (& cfg .settings .SV )),
837
+ MaxBlobReferenceDepth : int (valueSeparationMaxReferenceDepth .Get (& cfg .settings .SV )),
838
+ }
839
+ }
804
840
805
841
auxDir := cfg .opts .FS .PathJoin (cfg .env .Dir , base .AuxiliaryDir )
806
842
if ! cfg .env .IsReadOnly () {
0 commit comments