@@ -838,20 +838,22 @@ mergeCasesWithEqualKeys(MergeCounters& mc, BucketInputIterator& oi,
838
838
839
839
bool
840
840
Bucket::scanForEviction (AbstractLedgerTxn& ltx, EvictionIterator& iter,
841
- uint64_t & bytesToScan, uint32_t & maxEntriesToEvict,
842
- uint32_t ledgerSeq,
841
+ uint64_t & bytesToScan,
842
+ uint32_t & remainingEntriesToEvict, uint32_t ledgerSeq,
843
843
medida::Counter& entriesEvictedCounter,
844
844
medida::Counter& bytesScannedForEvictionCounter,
845
845
std::optional<EvictionMetrics>& metrics)
846
846
{
847
847
ZoneScoped;
848
- if (isEmpty ())
848
+ if (isEmpty () ||
849
+ protocolVersionIsBefore (getBucketVersion (shared_from_this ()),
850
+ SOROBAN_PROTOCOL_VERSION))
849
851
{
850
- // EOF
852
+ // EOF, skip to next bucket
851
853
return false ;
852
854
}
853
855
854
- if (maxEntriesToEvict == 0 || bytesToScan == 0 )
856
+ if (remainingEntriesToEvict == 0 || bytesToScan == 0 )
855
857
{
856
858
// Reached end of scan region
857
859
return true ;
@@ -908,7 +910,7 @@ Bucket::scanForEviction(AbstractLedgerTxn& ltx, EvictionIterator& iter,
908
910
ltx.erase (ttlKey);
909
911
ltx.erase (LedgerEntryKey (le));
910
912
entriesEvictedCounter.inc ();
911
- --maxEntriesToEvict ;
913
+ --remainingEntriesToEvict ;
912
914
}
913
915
914
916
stream.seek (initialStreamPos);
@@ -925,7 +927,7 @@ Bucket::scanForEviction(AbstractLedgerTxn& ltx, EvictionIterator& iter,
925
927
bytesToScan = 0 ;
926
928
return true ;
927
929
}
928
- else if (maxEntriesToEvict == 0 )
930
+ else if (remainingEntriesToEvict == 0 )
929
931
{
930
932
return true ;
931
933
}
0 commit comments