Skip to content

Commit

Permalink
Minor bucket manager cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
marta-lokhova committed Dec 19, 2024
1 parent d88c58f commit 8e7b826
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/bucket/BucketManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,15 +1047,15 @@ BucketManager::maybeSetIndex(std::shared_ptr<BucketBase> b,
}

void
BucketManager::startBackgroundEvictionScan(uint32_t ledgerSeq)
BucketManager::startBackgroundEvictionScan(uint32_t ledgerSeq,
SorobanNetworkConfig const& cfg)
{
releaseAssert(mSnapshotManager);
releaseAssert(!mEvictionFuture.valid());
releaseAssert(mEvictionStatistics);

auto searchableBL =
mSnapshotManager->copySearchableLiveBucketListSnapshot();
auto const& cfg = mApp.getLedgerManager().getSorobanNetworkConfig();
auto const& sas = cfg.stateArchivalSettings();

using task_t = std::packaged_task<EvictionResult()>;
Expand Down Expand Up @@ -1084,7 +1084,7 @@ BucketManager::resolveBackgroundEvictionScan(

if (!mEvictionFuture.valid())
{
startBackgroundEvictionScan(ledgerSeq);
startBackgroundEvictionScan(ledgerSeq, networkConfig);
}

auto evictionCandidates = mEvictionFuture.get();
Expand All @@ -1094,7 +1094,7 @@ BucketManager::resolveBackgroundEvictionScan(
if (!evictionCandidates.isValid(ledgerSeq,
networkConfig.stateArchivalSettings()))
{
startBackgroundEvictionScan(ledgerSeq);
startBackgroundEvictionScan(ledgerSeq, networkConfig);
evictionCandidates = mEvictionFuture.get();
}

Expand Down
3 changes: 2 additions & 1 deletion src/bucket/BucketManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/ledger/LedgerManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 8e7b826

Please sign in to comment.