Skip to content

Commit

Permalink
Remove dead code now that in-memory mode is dropped
Browse files Browse the repository at this point in the history
  • Loading branch information
marta-lokhova committed Jan 3, 2025
1 parent 229beb4 commit a757b61
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 60 deletions.
14 changes: 0 additions & 14 deletions src/catchup/ApplyBucketsWork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,20 +207,6 @@ ApplyBucketsWork::doWork()
if (!mAssumeStateWork)
{
// Step 2: apply buckets.
if (mApp.getLedgerManager().rebuildingInMemoryState() && !mDelayChecked)
{
mDelayChecked = true;
auto delay = mApp.getConfig()
.ARTIFICIALLY_DELAY_BUCKET_APPLICATION_FOR_TESTING;
if (delay != std::chrono::seconds::zero())
{
CLOG_INFO(History, "Delay bucket application by {} seconds",
delay.count());
setupWaitingCallback(delay);
return State::WORK_WAITING;
}
}

auto isCurr = mBucketToApplyIndex % 2 == 0;
if (mBucketApplicator)
{
Expand Down
1 change: 0 additions & 1 deletion src/catchup/ApplyBucketsWork.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class ApplyBucketsWork : public Work
std::unordered_set<LedgerKey> mSeenKeys;
std::vector<std::shared_ptr<LiveBucket>> mBucketsToApply;
std::unique_ptr<BucketApplicator> mBucketApplicator;
bool mDelayChecked{false};

BucketApplicator::Counters mCounters;
bool const mIsApplyInvariantEnabled;
Expand Down
5 changes: 0 additions & 5 deletions src/ledger/LedgerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ class LedgerManager
// and restart merges
virtual void loadLastKnownLedger(bool restoreBucketlist) = 0;

// Return true if core is currently rebuilding in-memory state via local
// catchup
virtual bool rebuildingInMemoryState() = 0;
virtual void setupInMemoryStateRebuild() = 0;

// Forcibly switch the application into catchup mode, treating `toLedger`
// as the destination ledger number and count as the number of past ledgers
// that should be replayed. Normally this happens automatically when
Expand Down
38 changes: 0 additions & 38 deletions src/ledger/LedgerManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,6 @@ LedgerManagerImpl::setState(State s)
{
mApp.getCatchupManager().logAndUpdateCatchupStatus(true);
}

if (mState == LM_CATCHING_UP_STATE && !mStartCatchup)
{
mStartCatchup = std::make_unique<VirtualClock::time_point>(
mApp.getClock().now());
}
else if (mState == LM_SYNCED_STATE && mStartCatchup)
{
std::chrono::nanoseconds duration =
mApp.getClock().now() - *mStartCatchup;
mCatchupDuration.Update(duration);
CLOG_DEBUG(Perf, "Caught up to the network in {} seconds",
std::chrono::duration<double>(duration).count());
}
}
}

Expand Down Expand Up @@ -398,30 +384,6 @@ LedgerManagerImpl::loadLastKnownLedger(bool restoreBucketlist)
}
}

bool
LedgerManagerImpl::rebuildingInMemoryState()
{
return mRebuildInMemoryState;
}

void
LedgerManagerImpl::setupInMemoryStateRebuild()
{
if (!mRebuildInMemoryState)
{
LedgerHeader lh;
HistoryArchiveState has;
auto& ps = mApp.getPersistentState();
ps.setState(PersistentState::kLastClosedLedger,
binToHex(xdrSha256(lh)));
ps.setState(PersistentState::kHistoryArchiveState, has.toString());
ps.setState(PersistentState::kLastSCPData, "");
ps.setState(PersistentState::kLastSCPDataXDR, "");
ps.setState(PersistentState::kLedgerUpgrades, "");
mRebuildInMemoryState = true;
}
}

Database&
LedgerManagerImpl::getDatabase()
{
Expand Down
2 changes: 0 additions & 2 deletions src/ledger/LedgerManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ class LedgerManagerImpl : public LedgerManager
void startNewLedger(LedgerHeader const& genesisLedger);
void startNewLedger() override;
void loadLastKnownLedger(bool restoreBucketlist) override;
virtual bool rebuildingInMemoryState() override;
virtual void setupInMemoryStateRebuild() override;

LedgerHeaderHistoryEntry const& getLastClosedLedgerHeader() const override;

Expand Down

0 comments on commit a757b61

Please sign in to comment.