@@ -150,6 +150,20 @@ func (r *reducer) setupRunDirs(
150
150
return testRootDir , runSubdirs
151
151
}
152
152
153
+ func (r * reducer ) getKeyFormat () metamorphic.KeyFormat {
154
+ if len (r .configs ) == 0 {
155
+ return metamorphic .TestkeysKeyFormat
156
+ }
157
+
158
+ optionsStr := string (r .configs [0 ].optionsData )
159
+ if strings .Contains (optionsStr , "comparer=cockroach_comparator" ) {
160
+ return metamorphic .CockroachKeyFormat
161
+ }
162
+
163
+ // Default to TestkeysKeyFormat (pebble.internal.testkeys is the default)
164
+ return metamorphic .TestkeysKeyFormat
165
+ }
166
+
153
167
func (r * reducer ) try (t * testing.T , ops []string ) bool {
154
168
testRootDir , runSubdirs := r .setupRunDirs (t , ops )
155
169
@@ -195,7 +209,7 @@ func (r *reducer) try(t *testing.T, ops []string) bool {
195
209
196
210
// Try to generate a diagram.
197
211
diagram , err := metamorphic .TryToGenerateDiagram (
198
- metamorphic . TestkeysKeyFormat ,
212
+ r . getKeyFormat () ,
199
213
[]byte (strings .Join (ops , "\n " )),
200
214
)
201
215
require .NoError (t , err )
@@ -231,7 +245,7 @@ func (r *reducer) Run(t *testing.T) {
231
245
// Try to simplify the keys.
232
246
opsData := []byte (strings .Join (ops , "\n " ))
233
247
for _ , retainSuffixes := range []bool {false , true } {
234
- newOpsData := metamorphic .TryToSimplifyKeys (metamorphic . TestkeysKeyFormat , opsData , retainSuffixes )
248
+ newOpsData := metamorphic .TryToSimplifyKeys (r . getKeyFormat () , opsData , retainSuffixes )
235
249
o := strings .Split (strings .TrimSpace (string (newOpsData )), "\n " )
236
250
if r .try (t , o ) {
237
251
return
0 commit comments