@@ -1344,17 +1344,6 @@ func (i *singleLevelIterator[I, PI, D, PD]) lastInternal() *base.InternalKV {
1344
1344
// Note: compactionIterator.Next mirrors the implementation of Iterator.Next
1345
1345
// due to performance. Keep the two in sync.
1346
1346
func (i * singleLevelIterator [I , PI , D , PD ]) Next () * base.InternalKV {
1347
- if invariants .Enabled && i .lastOpWasSeekPrefixGE .Get () {
1348
- // If the previous operation was SeekPrefixGE that returned nil due to bloom
1349
- // filter miss, the data block should not have been invalidated. This assertion
1350
- // ensures the optimization to preserve loaded blocks is working correctly.
1351
- if PD (& i .data ).IsDataInvalidated () {
1352
- panic ("pebble: data block was invalidated after SeekPrefixGE returned nil due to bloom filter miss" )
1353
- }
1354
- }
1355
- // Clear the tracking flag since this is no longer the next operation after SeekPrefixGE
1356
- i .lastOpWasSeekPrefixGE .Set (false )
1357
-
1358
1347
// The SeekPrefixGE might have returned a synthetic key with latest suffix
1359
1348
// contained in the sstable. If the caller is calling Next(), that means
1360
1349
// they want to move past the synthetic key and Next() is responsible for
@@ -1366,6 +1355,17 @@ func (i *singleLevelIterator[I, PI, D, PD]) Next() *base.InternalKV {
1366
1355
return i .seekPrefixGE (i .reader .Comparer .Split .Prefix (i .synthetic .seekKey ), i .synthetic .seekKey , base .SeekGEFlagsNone )
1367
1356
}
1368
1357
1358
+ if invariants .Enabled && i .lastOpWasSeekPrefixGE .Get () {
1359
+ // If the previous operation was SeekPrefixGE that returned nil due to bloom
1360
+ // filter miss, the data block should not have been invalidated. This assertion
1361
+ // ensures the optimization to preserve loaded blocks is working correctly.
1362
+ if PD (& i .data ).IsDataInvalidated () {
1363
+ panic ("pebble: data block was invalidated after SeekPrefixGE returned nil due to bloom filter miss" )
1364
+ }
1365
+ }
1366
+ // Clear the tracking flag since this is no longer the next operation after SeekPrefixGE
1367
+ i .lastOpWasSeekPrefixGE .Set (false )
1368
+
1369
1369
if i .exhaustedBounds == + 1 {
1370
1370
panic ("Next called even though exhausted upper bound" )
1371
1371
}
0 commit comments