@@ -19,6 +19,7 @@ import (
1919
2020 "github.com/cockroachdb/errors"
2121 "github.com/cockroachdb/pebble"
22+ "github.com/cockroachdb/pebble/cockroachkvs"
2223 "github.com/cockroachdb/pebble/internal/base"
2324 "github.com/cockroachdb/pebble/internal/keyspan"
2425 "github.com/cockroachdb/pebble/internal/private"
@@ -564,6 +565,32 @@ func (o *rangeKeySetOp) diagramKeyRanges() []pebble.KeyRange {
564565 return []pebble.KeyRange {{Start : o .start , End : o .end }}
565566}
566567
568+ // Helper functions to serialize/deserialize MaximumSuffixProperty for metamorphic tests
569+ func serializeMaximumSuffixProperty (prop pebble.MaximumSuffixProperty ) string {
570+ if prop == nil {
571+ return "nil"
572+ }
573+ switch prop .(type ) {
574+ case sstable.MaxTestKeysSuffixProperty :
575+ return "testkeys"
576+ default :
577+ return "cockroachkvs"
578+ }
579+ }
580+
581+ func deserializeMaximumSuffixProperty (s string ) pebble.MaximumSuffixProperty {
582+ switch s {
583+ case "nil" :
584+ return nil
585+ case "testkeys" :
586+ return sstable.MaxTestKeysSuffixProperty {}
587+ case "cockroachkvs" :
588+ return cockroachkvs.MaxMVCCTimestampProperty {}
589+ default :
590+ return nil
591+ }
592+ }
593+
567594// rangeKeyUnsetOp models a Write.RangeKeyUnset operation.
568595type rangeKeyUnsetOp struct {
569596 writerID objID
@@ -1206,10 +1233,10 @@ func (o *newIterOp) run(t *Test, h historyRecorder) {
12061233}
12071234
12081235func (o * newIterOp ) formattedString (kf KeyFormat ) string {
1209- return fmt .Sprintf ("%s = %s.NewIter(%q, %q, %d /* key types */, %q, %q, %t /* use L6 filters */, %q /* masking suffix */)" ,
1236+ return fmt .Sprintf ("%s = %s.NewIter(%q, %q, %d /* key types */, %q, %q, %t /* use L6 filters */, %q /* masking suffix */, %q /* maximum suffix property */ )" ,
12101237 o .iterID , o .readerID , kf .FormatKey (o .lower ), kf .FormatKey (o .upper ),
12111238 o .keyTypes , kf .FormatKeySuffix (o .filterMax ), kf .FormatKeySuffix (o .filterMin ),
1212- o .useL6Filters , kf .FormatKeySuffix (o .maskSuffix ))
1239+ o .useL6Filters , kf .FormatKeySuffix (o .maskSuffix ), serializeMaximumSuffixProperty ( o . maximumSuffixProperty ) )
12131240}
12141241
12151242func (o * newIterOp ) receiver () objID { return o .readerID }
@@ -1273,10 +1300,10 @@ func (o *newIterUsingCloneOp) run(t *Test, h historyRecorder) {
12731300}
12741301
12751302func (o * newIterUsingCloneOp ) formattedString (kf KeyFormat ) string {
1276- return fmt .Sprintf ("%s = %s.Clone(%t, %q, %q, %d /* key types */, %q, %q, %t /* use L6 filters */, %q /* masking suffix */)" ,
1303+ return fmt .Sprintf ("%s = %s.Clone(%t, %q, %q, %d /* key types */, %q, %q, %t /* use L6 filters */, %q /* masking suffix */, %q /* maximum suffix property */ )" ,
12771304 o .iterID , o .existingIterID , o .refreshBatch , kf .FormatKey (o .lower ),
12781305 kf .FormatKey (o .upper ), o .keyTypes , kf .FormatKeySuffix (o .filterMax ),
1279- kf .FormatKeySuffix (o .filterMin ), o .useL6Filters , kf .FormatKeySuffix (o .maskSuffix ))
1306+ kf .FormatKeySuffix (o .filterMin ), o .useL6Filters , kf .FormatKeySuffix (o .maskSuffix ), serializeMaximumSuffixProperty ( o . maximumSuffixProperty ) )
12801307}
12811308
12821309func (o * newIterUsingCloneOp ) receiver () objID { return o .existingIterID }
@@ -1370,10 +1397,10 @@ func (o *iterSetOptionsOp) run(t *Test, h historyRecorder) {
13701397}
13711398
13721399func (o * iterSetOptionsOp ) formattedString (kf KeyFormat ) string {
1373- return fmt .Sprintf ("%s.SetOptions(%q, %q, %d /* key types */, %q, %q, %t /* use L6 filters */, %q /* masking suffix */)" ,
1400+ return fmt .Sprintf ("%s.SetOptions(%q, %q, %d /* key types */, %q, %q, %t /* use L6 filters */, %q /* masking suffix */, %q /* maximum suffix property */ )" ,
13741401 o .iterID , kf .FormatKey (o .lower ), kf .FormatKey (o .upper ),
13751402 o .keyTypes , kf .FormatKeySuffix (o .filterMax ), kf .FormatKeySuffix (o .filterMin ),
1376- o .useL6Filters , kf .FormatKeySuffix (o .maskSuffix ))
1403+ o .useL6Filters , kf .FormatKeySuffix (o .maskSuffix ), serializeMaximumSuffixProperty ( o . maximumSuffixProperty ) )
13771404}
13781405
13791406func iterOptions (kf KeyFormat , o iterOpts ) * pebble.IterOptions {
@@ -1394,8 +1421,9 @@ func iterOptions(kf KeyFormat, o iterOpts) *pebble.IterOptions {
13941421 RangeKeyMasking : pebble.RangeKeyMasking {
13951422 Suffix : o .maskSuffix ,
13961423 },
1397- UseL6Filters : o .useL6Filters ,
1398- DebugRangeKeyStack : debugIterators ,
1424+ UseL6Filters : o .useL6Filters ,
1425+ DebugRangeKeyStack : debugIterators ,
1426+ MaximumSuffixProperty : o .maximumSuffixProperty ,
13991427 }
14001428 if opts .RangeKeyMasking .Suffix != nil {
14011429 opts .RangeKeyMasking .Filter = kf .NewSuffixFilterMask
0 commit comments