Skip to content

Commit 32784b6

Browse files
committed
Warn more agressively on eviciton scans
1 parent e35d89e commit 32784b6

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/bucket/BucketList.cpp

+16-11
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,22 @@ BucketList::scanForEviction(Application& app, AbstractLedgerTxn& ltx,
891891
auto initialLevel = evictionIter.bucketListLevel;
892892
auto initialIsCurr = evictionIter.isCurrBucket;
893893
auto b = getBucketFromIter(evictionIter);
894+
895+
// Check to see if we can finish scanning the bucket before it receives
896+
// an update
897+
auto period = bucketUpdatePeriod(evictionIter.bucketListLevel,
898+
evictionIter.isCurrBucket);
899+
900+
// Ledgers remaining until the current Bucket changes
901+
auto ledgersRemainingToScanBucket = period - (ledgerSeq % period);
902+
auto bytesRemaining = b->getSize() - evictionIter.bucketFileOffset;
903+
if (ledgersRemainingToScanBucket * scanSize < bytesRemaining)
904+
{
905+
CLOG_WARNING(Bucket,
906+
"Bucket too large for current eviction scan size.");
907+
incompleteBucketScanCounter.inc();
908+
}
909+
894910
while (!b->scanForEviction(
895911
ltx, evictionIter, scanSize, maxEntriesToEvict, ledgerSeq,
896912
entriesEvictedMeter, bytesScannedForEvictionCounter))
@@ -926,17 +942,6 @@ BucketList::scanForEviction(Application& app, AbstractLedgerTxn& ltx,
926942
}
927943

928944
b = getBucketFromIter(evictionIter);
929-
930-
// Check to see if we can finish scanning the new bucket before it
931-
// receives an update
932-
auto period = bucketUpdatePeriod(evictionIter.bucketListLevel,
933-
evictionIter.isCurrBucket);
934-
if (period * scanSize < b->getSize())
935-
{
936-
CLOG_WARNING(
937-
Bucket, "Bucket too large for current eviction scan size.");
938-
incompleteBucketScanCounter.inc();
939-
}
940945
}
941946

942947
networkConfig.updateEvictionIterator(ltx, evictionIter);

0 commit comments

Comments
 (0)