diff --git a/src/bucket/Bucket.cpp b/src/bucket/Bucket.cpp index 2c203c355f..2785eca637 100644 --- a/src/bucket/Bucket.cpp +++ b/src/bucket/Bucket.cpp @@ -873,14 +873,15 @@ Bucket::scanForEviction(AbstractLedgerTxn& ltx, EvictionIterator& iter, auto expirationKey = getExpirationKey(le); auto shouldEvict = [&] { auto entryLtxe = ltx.loadWithoutRecord(LedgerEntryKey(le)); + auto expirationLtxe = ltx.loadWithoutRecord(expirationKey); if (!entryLtxe) { // Entry was already deleted either manually or by an // earlier eviction scan, do nothing + releaseAssert(!expirationLtxe); return false; } - auto expirationLtxe = ltx.loadWithoutRecord(expirationKey); releaseAssert(expirationLtxe); return !isLive(expirationLtxe.current(), ledgerSeq); @@ -905,6 +906,7 @@ Bucket::scanForEviction(AbstractLedgerTxn& ltx, EvictionIterator& iter, if (bytesRead >= bytesToScan) { // Reached end of scan region + bytesToScan = 0; return true; }