Skip to content

Commit 2d5751c

Browse files
committedFeb 13, 2024··
Warn more agressively on eviciton scans
1 parent 9d91d8b commit 2d5751c

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
@@ -889,6 +889,22 @@ BucketList::scanForEviction(Application& app, AbstractLedgerTxn& ltx,
889889
auto initialLevel = evictionIter.bucketListLevel;
890890
auto initialIsCurr = evictionIter.isCurrBucket;
891891
auto b = getBucketFromIter(evictionIter);
892+
893+
// Check to see if we can finish scanning the bucket before it receives
894+
// an update
895+
auto period = bucketUpdatePeriod(evictionIter.bucketListLevel,
896+
evictionIter.isCurrBucket);
897+
898+
// Ledgers remaining until the current Bucket changes
899+
auto ledgersRemainingToScanBucket = period - (ledgerSeq % period);
900+
auto bytesRemaining = b->getSize() - evictionIter.bucketFileOffset;
901+
if (ledgersRemainingToScanBucket * scanSize < bytesRemaining)
902+
{
903+
CLOG_WARNING(Bucket,
904+
"Bucket too large for current eviction scan size.");
905+
counters.incompleteBucketScan.inc();
906+
}
907+
892908
while (!b->scanForEviction(
893909
ltx, evictionIter, scanSize, maxEntriesToEvict, ledgerSeq,
894910
counters.entriesEvicted, counters.bytesScannedForEviction,
@@ -945,17 +961,6 @@ BucketList::scanForEviction(Application& app, AbstractLedgerTxn& ltx,
945961
}
946962

947963
b = getBucketFromIter(evictionIter);
948-
949-
// Check to see if we can finish scanning the new bucket before it
950-
// receives an update
951-
auto period = bucketUpdatePeriod(evictionIter.bucketListLevel,
952-
evictionIter.isCurrBucket);
953-
if (period * scanSize < b->getSize())
954-
{
955-
CLOG_WARNING(
956-
Bucket, "Bucket too large for current eviction scan size.");
957-
counters.incompleteBucketScan.inc();
958-
}
959964
}
960965

961966
networkConfig.updateEvictionIterator(ltx, evictionIter);

0 commit comments

Comments
 (0)
Please sign in to comment.