From 8e7b82670ab5a17634ec6c1300a7a909b1945deb Mon Sep 17 00:00:00 2001 From: marta-lokhova Date: Thu, 19 Dec 2024 13:24:47 -0800 Subject: [PATCH] Minor bucket manager cleanup --- src/bucket/BucketManager.cpp | 8 ++++---- src/bucket/BucketManager.h | 3 ++- src/ledger/LedgerManagerImpl.cpp | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/bucket/BucketManager.cpp b/src/bucket/BucketManager.cpp index c4f7b07130..14f65eed07 100644 --- a/src/bucket/BucketManager.cpp +++ b/src/bucket/BucketManager.cpp @@ -1047,7 +1047,8 @@ BucketManager::maybeSetIndex(std::shared_ptr b, } void -BucketManager::startBackgroundEvictionScan(uint32_t ledgerSeq) +BucketManager::startBackgroundEvictionScan(uint32_t ledgerSeq, + SorobanNetworkConfig const& cfg) { releaseAssert(mSnapshotManager); releaseAssert(!mEvictionFuture.valid()); @@ -1055,7 +1056,6 @@ BucketManager::startBackgroundEvictionScan(uint32_t ledgerSeq) auto searchableBL = mSnapshotManager->copySearchableLiveBucketListSnapshot(); - auto const& cfg = mApp.getLedgerManager().getSorobanNetworkConfig(); auto const& sas = cfg.stateArchivalSettings(); using task_t = std::packaged_task; @@ -1084,7 +1084,7 @@ BucketManager::resolveBackgroundEvictionScan( if (!mEvictionFuture.valid()) { - startBackgroundEvictionScan(ledgerSeq); + startBackgroundEvictionScan(ledgerSeq, networkConfig); } auto evictionCandidates = mEvictionFuture.get(); @@ -1094,7 +1094,7 @@ BucketManager::resolveBackgroundEvictionScan( if (!evictionCandidates.isValid(ledgerSeq, networkConfig.stateArchivalSettings())) { - startBackgroundEvictionScan(ledgerSeq); + startBackgroundEvictionScan(ledgerSeq, networkConfig); evictionCandidates = mEvictionFuture.get(); } diff --git a/src/bucket/BucketManager.h b/src/bucket/BucketManager.h index 5955cabaac..5c4d696a35 100644 --- a/src/bucket/BucketManager.h +++ b/src/bucket/BucketManager.h @@ -298,7 +298,8 @@ class BucketManager : NonMovableOrCopyable // Scans BucketList for non-live entries to evict starting at the entry // pointed to by EvictionIterator. Evicts until `maxEntriesToEvict` entries // have been evicted or maxEvictionScanSize bytes have been scanned. - void startBackgroundEvictionScan(uint32_t ledgerSeq); + void startBackgroundEvictionScan(uint32_t ledgerSeq, + SorobanNetworkConfig const& cfg); void resolveBackgroundEvictionScan(AbstractLedgerTxn& ltx, uint32_t ledgerSeq, LedgerKeySet const& modifiedKeys, diff --git a/src/ledger/LedgerManagerImpl.cpp b/src/ledger/LedgerManagerImpl.cpp index 93127a964a..1249da84a5 100644 --- a/src/ledger/LedgerManagerImpl.cpp +++ b/src/ledger/LedgerManagerImpl.cpp @@ -1056,7 +1056,8 @@ LedgerManagerImpl::closeLedger(LedgerCloseData const& ledgerData, // Step 4 if (protocolVersionStartsFrom(initialLedgerVers, SOROBAN_PROTOCOL_VERSION)) { - mApp.getBucketManager().startBackgroundEvictionScan(ledgerSeq + 1); + mApp.getBucketManager().startBackgroundEvictionScan( + ledgerSeq + 1, getSorobanNetworkConfig()); } // Invoke completion handler on the _main_ thread: kick off publishing,