@@ -1181,9 +1181,6 @@ const debugIterators = false
1181
1181
func (o * newIterOp ) run (t * Test , h historyRecorder ) {
1182
1182
r := t .getReader (o .readerID )
1183
1183
opts := iterOptions (t .testOpts .KeyFormat , o .iterOpts )
1184
- if debugIterators {
1185
- opts .DebugRangeKeyStack = true
1186
- }
1187
1184
1188
1185
var i * pebble.Iterator
1189
1186
for {
@@ -1261,9 +1258,14 @@ type newIterUsingCloneOp struct {
1261
1258
func (o * newIterUsingCloneOp ) run (t * Test , h historyRecorder ) {
1262
1259
iter := t .getIter (o .existingIterID )
1263
1260
cloneOpts := pebble.CloneOptions {
1264
- IterOptions : iterOptions (t .testOpts .KeyFormat , o .iterOpts ),
1265
1261
RefreshBatchView : o .refreshBatch ,
1266
1262
}
1263
+ // We treat the zero options as an indication that we want to keep the options
1264
+ // of the original iterator. This way, we don't depend on iterOptions() and
1265
+ // whether it returns nil or not.
1266
+ if ! o .iterOpts .IsZero () {
1267
+ cloneOpts .IterOptions = iterOptions (t .testOpts .KeyFormat , o .iterOpts )
1268
+ }
1267
1269
i , err := iter .iter .Clone (cloneOpts )
1268
1270
if err != nil {
1269
1271
panic (err )
@@ -1377,7 +1379,10 @@ func (o *iterSetOptionsOp) formattedString(kf KeyFormat) string {
1377
1379
}
1378
1380
1379
1381
func iterOptions (kf KeyFormat , o iterOpts ) * pebble.IterOptions {
1380
- if o .IsZero () && ! debugIterators {
1382
+ // Sometimes exempt from tracking.
1383
+ exemptFromTracking := rand .IntN (4 ) == 0
1384
+ if o .IsZero () && ! debugIterators && ! exemptFromTracking && rand .IntN (2 ) == 0 {
1385
+ // Sometimes return nil if we are using the default options.
1381
1386
return nil
1382
1387
}
1383
1388
var lower , upper []byte
@@ -1395,6 +1400,7 @@ func iterOptions(kf KeyFormat, o iterOpts) *pebble.IterOptions {
1395
1400
Suffix : o .maskSuffix ,
1396
1401
},
1397
1402
UseL6Filters : o .useL6Filters ,
1403
+ ExemptFromTracking : exemptFromTracking ,
1398
1404
DebugRangeKeyStack : debugIterators ,
1399
1405
}
1400
1406
if opts .RangeKeyMasking .Suffix != nil {
0 commit comments