Skip to content

Commit ce94d05

Browse files
committed
Revert "db: add MinimumLatencyTolerantSize to ValueSeparationPolicy struct"
This reverts commit d5052bf.
1 parent 895ad9f commit ce94d05

File tree

10 files changed

+56
-81
lines changed

10 files changed

+56
-81
lines changed

data_test.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,6 @@ func describeLSM(d *DB, verbose bool) string {
16731673

16741674
func parseDBOptionsArgs(opts *Options, args []datadriven.CmdArg) error {
16751675
var spanPolicies []SpanAndPolicy
1676-
var policy ValueSeparationPolicy
16771676
for _, cmdArg := range args {
16781677
switch cmdArg.Key {
16791678
case "auto-compactions":
@@ -1803,13 +1802,10 @@ func parseDBOptionsArgs(opts *Options, args []datadriven.CmdArg) error {
18031802
Start: []byte(cmdArg.Vals[0]),
18041803
End: []byte(cmdArg.Vals[1]),
18051804
}
1806-
policyAdjustment := ValueStoragePolicyAdjustment{
1807-
OverrideBlobSeparationMinimumSize: policy.MinimumLatencyTolerantSize,
1808-
}
1809-
spanPolicy := SpanPolicy{ValueStoragePolicy: policyAdjustment}
1805+
policy := SpanPolicy{ValueStoragePolicy: ValueStorageLatencyTolerant}
18101806
spanPolicies = append(spanPolicies, SpanAndPolicy{
18111807
KeyRange: span,
1812-
Policy: spanPolicy,
1808+
Policy: policy,
18131809
})
18141810
case "target-file-sizes":
18151811
if len(cmdArg.Vals) > len(opts.Levels) {
@@ -1836,6 +1832,7 @@ func parseDBOptionsArgs(opts *Options, args []datadriven.CmdArg) error {
18361832
opts.FlushSplitBytes = flushSplitBytes
18371833

18381834
case "value-separation":
1835+
var policy ValueSeparationPolicy
18391836
if len(cmdArg.Vals) == 1 && cmdArg.Vals[0] == "off" || cmdArg.Vals[0] == "disabled" {
18401837
policy.Enabled = false
18411838
} else {
@@ -1847,7 +1844,6 @@ func parseDBOptionsArgs(opts *Options, args []datadriven.CmdArg) error {
18471844
name = arg[:i]
18481845
value = arg[i+1:]
18491846
}
1850-
policy.MinimumLatencyTolerantSize = 10
18511847
policy.MinimumMVCCGarbageSize = 1
18521848
var err error
18531849
switch name {
@@ -1858,11 +1854,6 @@ func parseDBOptionsArgs(opts *Options, args []datadriven.CmdArg) error {
18581854
if err != nil {
18591855
return err
18601856
}
1861-
case "min-latency-tolerant-size":
1862-
policy.MinimumLatencyTolerantSize, err = strconv.Atoi(value)
1863-
if err != nil {
1864-
return err
1865-
}
18661857
case "min-mvcc-garbage-size":
18671858
policy.MinimumMVCCGarbageSize, err = strconv.Atoi(value)
18681859
if err != nil {

event_listener_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,10 @@ func TestBlobCorruptionEvent(t *testing.T) {
633633
}
634634
opts.Experimental.ValueSeparationPolicy = func() ValueSeparationPolicy {
635635
return ValueSeparationPolicy{
636-
Enabled: true,
637-
MinimumSize: 1,
638-
MinimumLatencyTolerantSize: 10,
639-
MinimumMVCCGarbageSize: 10,
640-
MaxBlobReferenceDepth: 10,
636+
Enabled: true,
637+
MinimumSize: 1,
638+
MinimumMVCCGarbageSize: 10,
639+
MaxBlobReferenceDepth: 10,
641640
}
642641
}
643642
d, err := Open("", opts)

iterator_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,11 +1420,10 @@ func TestIteratorValueRetrievalProfile(t *testing.T) {
14201420
opts.FormatMajorVersion = internalFormatNewest
14211421
opts.Experimental.ValueSeparationPolicy = func() ValueSeparationPolicy {
14221422
return ValueSeparationPolicy{
1423-
Enabled: true,
1424-
MinimumSize: 1,
1425-
MinimumLatencyTolerantSize: 10,
1426-
MinimumMVCCGarbageSize: 10,
1427-
MaxBlobReferenceDepth: 5,
1423+
Enabled: true,
1424+
MinimumSize: 1,
1425+
MinimumMVCCGarbageSize: 10,
1426+
MaxBlobReferenceDepth: 5,
14281427
}
14291428
}
14301429
d := newTestkeysDatabase(t, opts, testkeys.Alpha(2), rand.New(rand.NewPCG(1, 1)))

metamorphic/options.go

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,13 @@ func defaultOptions(kf KeyFormat) *pebble.Options {
311311

312312
opts.Experimental.ValueSeparationPolicy = func() pebble.ValueSeparationPolicy {
313313
return pebble.ValueSeparationPolicy{
314-
Enabled: true,
315-
MinimumSize: 5,
316-
MinimumLatencyTolerantSize: 10,
317-
MinimumMVCCGarbageSize: 10,
318-
MaxBlobReferenceDepth: 3,
319-
RewriteMinimumAge: 50 * time.Millisecond,
320-
GarbageRatioLowPriority: 0.10, // 10% garbage
321-
GarbageRatioHighPriority: 0.30, // 30% garbage
314+
Enabled: true,
315+
MinimumSize: 5,
316+
MinimumMVCCGarbageSize: 10,
317+
MaxBlobReferenceDepth: 3,
318+
RewriteMinimumAge: 50 * time.Millisecond,
319+
GarbageRatioLowPriority: 0.10, // 10% garbage
320+
GarbageRatioHighPriority: 0.30, // 30% garbage
322321
}
323322
}
324323

@@ -898,14 +897,13 @@ func RandomOptions(rng *rand.Rand, kf KeyFormat, cfg RandomOptionsCfg) *TestOpti
898897
}
899898
lowPri := max(rng.Float64(), 0.05)
900899
policy := pebble.ValueSeparationPolicy{
901-
Enabled: true,
902-
MinimumSize: 1 + rng.IntN(maxValueSize),
903-
MinimumLatencyTolerantSize: 5 + rng.IntN(11), // [5, 15] bytes
904-
MinimumMVCCGarbageSize: 5 + rng.IntN(11), // [5, 15] bytes
905-
MaxBlobReferenceDepth: 2 + rng.IntN(9), // 2-10
906-
RewriteMinimumAge: time.Duration(rng.IntN(90)+10) * time.Millisecond, // [10ms, 100ms)
907-
GarbageRatioLowPriority: lowPri,
908-
GarbageRatioHighPriority: lowPri + rand.Float64()*(1.0-lowPri), // [lowPri, 1.0)
900+
Enabled: true,
901+
MinimumSize: 1 + rng.IntN(maxValueSize),
902+
MinimumMVCCGarbageSize: 5 + rng.IntN(11), // [5, 15] bytes
903+
MaxBlobReferenceDepth: 2 + rng.IntN(9), // 2-10
904+
RewriteMinimumAge: time.Duration(rng.IntN(90)+10) * time.Millisecond, // [10ms, 100ms)
905+
GarbageRatioLowPriority: lowPri,
906+
GarbageRatioHighPriority: lowPri + rand.Float64()*(1.0-lowPri), // [lowPri, 1.0)
909907
}
910908
opts.Experimental.ValueSeparationPolicy = func() pebble.ValueSeparationPolicy {
911909
return policy

metrics_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,10 @@ func TestMetrics(t *testing.T) {
269269
opts.Experimental.EnableValueBlocks = func() bool { return true }
270270
opts.Experimental.ValueSeparationPolicy = func() ValueSeparationPolicy {
271271
return ValueSeparationPolicy{
272-
Enabled: true,
273-
MinimumSize: 3,
274-
MinimumLatencyTolerantSize: 10,
275-
MinimumMVCCGarbageSize: 10,
276-
MaxBlobReferenceDepth: 5,
272+
Enabled: true,
273+
MinimumSize: 3,
274+
MinimumMVCCGarbageSize: 10,
275+
MaxBlobReferenceDepth: 5,
277276
}
278277
}
279278
opts.TargetFileSizes[0] = 50

options.go

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,12 +1233,6 @@ type ValueSeparationPolicy struct {
12331233
//
12341234
// MinimumSize must be > 0.
12351235
MinimumSize int
1236-
// MinimumLatencyTolerantSize specifies the minimum size of a value that can
1237-
// be separated into a blob file if said value is a part of a latency tolerant
1238-
// span.
1239-
//
1240-
// MinimumLatencyTolerantSize must be > 0.
1241-
MinimumLatencyTolerantSize int
12421236
// MinimumMVCCGarbageSize specifies the minimum size of a value that can be
12431237
// separated into a blob file if said value is likely to be MVCC garbage.
12441238
// See sstable.IsLikelyMVCCGarbage for the exact criteria we use to
@@ -1287,7 +1281,8 @@ type ValueSeparationPolicy struct {
12871281
GarbageRatioHighPriority float64
12881282
}
12891283

1290-
// SpanPolicy contains policies that can vary by key range.
1284+
// SpanPolicy contains policies that can vary by key range. The zero value is
1285+
// the default value.
12911286
type SpanPolicy struct {
12921287
// Prefer a faster compression algorithm for the keys in this span.
12931288
//
@@ -1364,6 +1359,13 @@ func (vsp *ValueStoragePolicyAdjustment) ContainsOverrides() bool {
13641359
vsp.MinimumMVCCGarbageSize > 0
13651360
}
13661361

1362+
// ValueStorageLatencyTolerant is the suggested ValueStoragePolicyAdjustment
1363+
// to use for key ranges that can tolerate higher value retrieval
1364+
// latency.
1365+
var ValueStorageLatencyTolerant = ValueStoragePolicyAdjustment{
1366+
OverrideBlobSeparationMinimumSize: 10,
1367+
}
1368+
13671369
// ValueStorageLowReadLatency is the suggested ValueStoragePolicyAdjustment
13681370
// to use for key ranges that require low value retrieval latency.
13691371
var ValueStorageLowReadLatency = ValueStoragePolicyAdjustment{
@@ -1873,7 +1875,6 @@ func (o *Options) String() string {
18731875
fmt.Fprintln(&buf, "[Value Separation]")
18741876
fmt.Fprintf(&buf, " enabled=%t\n", policy.Enabled)
18751877
fmt.Fprintf(&buf, " minimum_size=%d\n", policy.MinimumSize)
1876-
fmt.Fprintf(&buf, " minimum_latency_tolerant_size=%d\n", policy.MinimumLatencyTolerantSize)
18771878
fmt.Fprintf(&buf, " minimum_mvcc_garbage_size=%d\n", policy.MinimumMVCCGarbageSize)
18781879
fmt.Fprintf(&buf, " max_blob_reference_depth=%d\n", policy.MaxBlobReferenceDepth)
18791880
fmt.Fprintf(&buf, " rewrite_minimum_age=%s\n", policy.RewriteMinimumAge)
@@ -2325,10 +2326,6 @@ func (o *Options) Parse(s string, hooks *ParseHooks) error {
23252326
var minimumSize int
23262327
minimumSize, err = strconv.Atoi(value)
23272328
valSepPolicy.MinimumSize = minimumSize
2328-
case "minimum_latency_tolerant_size":
2329-
var minimumLatencyTolerantSize int
2330-
minimumLatencyTolerantSize, err = strconv.Atoi(value)
2331-
valSepPolicy.MinimumLatencyTolerantSize = minimumLatencyTolerantSize
23322329
case "minimum_mvcc_garbage_size":
23332330
var minimumMVCCGarbageSize int
23342331
minimumMVCCGarbageSize, err = strconv.Atoi(value)
@@ -2633,9 +2630,6 @@ func (o *Options) Validate() error {
26332630
if policy.MinimumSize <= 0 {
26342631
fmt.Fprintf(&buf, "ValueSeparationPolicy.MinimumSize (%d) must be > 0\n", policy.MinimumSize)
26352632
}
2636-
if policy.MinimumLatencyTolerantSize <= 0 {
2637-
fmt.Fprintf(&buf, "ValueSeparationPolicy.MinimumLatencyTolerantSize (%d) must be > 0\n", policy.MinimumLatencyTolerantSize)
2638-
}
26392633
if policy.MinimumMVCCGarbageSize <= 0 {
26402634
fmt.Fprintf(&buf, "ValueSeparationPolicy.MinimumMVCCGarbageSize (%d) must be > 0\n", policy.MinimumMVCCGarbageSize)
26412635
}

options_test.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ func (o *Options) randomizeForTesting(t testing.TB) {
4242
if o.FormatMajorVersion >= FormatValueSeparation && o.Experimental.ValueSeparationPolicy == nil && rand.Int64N(4) > 0 {
4343
lowPri := 0.1 + rand.Float64()*0.9 // [0.1, 1.0)
4444
policy := ValueSeparationPolicy{
45-
Enabled: true,
46-
MinimumSize: 1 << rand.IntN(10), // [1, 512]
47-
MinimumLatencyTolerantSize: 5 + rand.IntN(11), // [5, 15]
48-
MinimumMVCCGarbageSize: 5 + rand.IntN(11), // [5, 15]
49-
MaxBlobReferenceDepth: 1 + rand.IntN(10), // [1, 10]
45+
Enabled: true,
46+
MinimumSize: 1 << rand.IntN(10), // [1, 512]
47+
MinimumMVCCGarbageSize: 5 + rand.IntN(11), // [5, 15]
48+
MaxBlobReferenceDepth: 1 + rand.IntN(10), // [1, 10]
5049
// Constrain the rewrite minimum age to [0, 15s).
5150
RewriteMinimumAge: time.Duration(rand.IntN(15)) * time.Second,
5251
GarbageRatioLowPriority: lowPri,
@@ -660,9 +659,7 @@ func TestStaticSpanPolicyFunc(t *testing.T) {
660659
case "lowlatency":
661660
sap.Policy.ValueStoragePolicy = ValueStorageLowReadLatency
662661
case "latencytolerant":
663-
sap.Policy.ValueStoragePolicy = ValueStoragePolicyAdjustment{
664-
OverrideBlobSeparationMinimumSize: 10,
665-
}
662+
sap.Policy.ValueStoragePolicy = ValueStorageLatencyTolerant
666663
default:
667664
t.Fatalf("unknown policy: %s", tok)
668665
}

replay/replay_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,11 @@ func collectCorpus(t *testing.T, fs *vfs.MemFS, name string) {
350350
}
351351
opts.Experimental.ValueSeparationPolicy = func() pebble.ValueSeparationPolicy {
352352
return pebble.ValueSeparationPolicy{
353-
Enabled: true,
354-
MinimumSize: 3,
355-
MinimumLatencyTolerantSize: 10,
356-
MinimumMVCCGarbageSize: 10,
357-
MaxBlobReferenceDepth: 5,
358-
RewriteMinimumAge: 15 * time.Minute,
353+
Enabled: true,
354+
MinimumSize: 3,
355+
MinimumMVCCGarbageSize: 10,
356+
MaxBlobReferenceDepth: 5,
357+
RewriteMinimumAge: 15 * time.Minute,
359358
}
360359
}
361360
setDefaultExperimentalOpts(opts)

replay/testdata/replay_val_sep

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ tree
1717
0 LOCK
1818
152 MANIFEST-000010
1919
250 MANIFEST-000013
20-
2977 OPTIONS-000002
20+
2942 OPTIONS-000002
2121
0 marker.format-version.000011.024
2222
0 marker.manifest.000003.MANIFEST-000013
2323
simple_val_sep/
@@ -32,7 +32,7 @@ tree
3232
11 000011.log
3333
687 000012.sst
3434
187 MANIFEST-000013
35-
2977 OPTIONS-000002
35+
2942 OPTIONS-000002
3636
0 marker.format-version.000001.024
3737
0 marker.manifest.000001.MANIFEST-000013
3838

@@ -92,7 +92,6 @@ cat build/OPTIONS-000002
9292
[Value Separation]
9393
enabled=true
9494
minimum_size=3
95-
minimum_latency_tolerant_size=10
9695
minimum_mvcc_garbage_size=10
9796
max_blob_reference_depth=5
9897
rewrite_minimum_age=15m0s

testdata/metrics

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ Iter category stats:
236236

237237
disk-usage
238238
----
239-
3,719B
239+
3,684B
240240

241241
batch
242242
set b 2
@@ -365,7 +365,7 @@ Iter category stats:
365365

366366
disk-usage
367367
----
368-
5,952B
368+
5,917B
369369

370370
# Closing iter a will release one of the zombie memtables.
371371

@@ -584,7 +584,7 @@ Iter category stats:
584584

585585
disk-usage
586586
----
587-
5,265B
587+
5,230B
588588

589589
# Closing iter b will release the last zombie sstable and the last zombie memtable.
590590

@@ -695,7 +695,7 @@ Iter category stats:
695695

696696
disk-usage
697697
----
698-
4,578B
698+
4,543B
699699

700700
additional-metrics
701701
----
@@ -2600,12 +2600,12 @@ Blob files:
26002600

26012601
disk-usage
26022602
----
2603-
7,640B
2603+
7,605B
26042604

26052605
init reopen
26062606
----
26072607

26082608
# The disk usage is expected to go down a bit because we remove the WALs.
26092609
disk-usage
26102610
----
2611-
7,123B
2611+
7,088B

0 commit comments

Comments
 (0)