Skip to content

Commit

Permalink
Fix acceptance tests (#4615)
Browse files Browse the repository at this point in the history
* Update catchup tests to reflect the new LM policy for being in sync
* Rename CatchupManager to LedgerApplyManager to more accurately capture
module's responsibilities
  • Loading branch information
marta-lokhova authored Jan 9, 2025
2 parents bef355b + eee6d00 commit 70e4151
Show file tree
Hide file tree
Showing 23 changed files with 152 additions and 146 deletions.
4 changes: 2 additions & 2 deletions src/catchup/ApplyBucketsWork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include "bucket/LiveBucket.h"
#include "bucket/LiveBucketList.h"
#include "catchup/AssumeStateWork.h"
#include "catchup/CatchupManager.h"
#include "catchup/IndexBucketsWork.h"
#include "catchup/LedgerApplyManager.h"
#include "crypto/Hex.h"
#include "crypto/SecretKey.h"
#include "historywork/Progress.h"
Expand Down Expand Up @@ -169,7 +169,7 @@ ApplyBucketsWork::prepareForNextBucket()
{
ZoneScoped;
mBucketApplicator.reset();
mApp.getCatchupManager().bucketsApplied();
mApp.getLedgerApplyManager().bucketsApplied();
mBucketToApplyIndex++;
// If mBucketToApplyIndex is even, we are progressing to the next
// level
Expand Down
2 changes: 1 addition & 1 deletion src/catchup/ApplyBufferedLedgersWork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ApplyBufferedLedgersWork::onRun()
}

std::optional<LedgerCloseData> maybeLcd =
mApp.getCatchupManager().maybeGetNextBufferedLedgerToApply();
mApp.getLedgerApplyManager().maybeGetNextBufferedLedgerToApply();

if (!maybeLcd)
{
Expand Down
2 changes: 1 addition & 1 deletion src/catchup/ApplyCheckpointWork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ ApplyCheckpointWork::onRun()
lm.getLastClosedLedgerHeader())));
}

mApp.getCatchupManager().txSetsApplied();
mApp.getLedgerApplyManager().txSetsApplied();
}
else
{
Expand Down
9 changes: 5 additions & 4 deletions src/catchup/CatchupWork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@ CatchupWork::runCatchupStep()
}
}
// see if we need to apply buffered ledgers
if (mApp.getCatchupManager().maybeGetNextBufferedLedgerToApply())
if (mApp.getLedgerApplyManager()
.maybeGetNextBufferedLedgerToApply())
{
mApplyBufferedLedgersWork = addWork<ApplyBufferedLedgersWork>();
mCurrentWork = mApplyBufferedLedgersWork;
Expand Down Expand Up @@ -632,14 +633,14 @@ CatchupWork::doWork()
{
ZoneScoped;
auto nextState = runCatchupStep();
auto& cm = mApp.getCatchupManager();
auto& lam = mApp.getLedgerApplyManager();

if (nextState == BasicWork::State::WORK_SUCCESS)
{
releaseAssert(!cm.maybeGetNextBufferedLedgerToApply());
releaseAssert(!lam.maybeGetNextBufferedLedgerToApply());
}

cm.logAndUpdateCatchupStatus(true);
lam.logAndUpdateCatchupStatus(true);
return nextState;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Application;
class CatchupMetrics;
class FileTransferInfo;

class CatchupManager
class LedgerApplyManager
{
public:
struct CatchupMetrics
Expand Down Expand Up @@ -55,7 +55,7 @@ class CatchupManager
PROCESSED_ALL_LEDGERS_SEQUENTIALLY,
WAIT_TO_APPLY_BUFFERED_OR_CATCHUP
};
static std::unique_ptr<CatchupManager> create(Application& app);
static std::unique_ptr<LedgerApplyManager> create(Application& app);

// Process ledgers that could not be applied, and determine if catchup
// should run
Expand Down Expand Up @@ -97,16 +97,16 @@ class CatchupManager
virtual void logAndUpdateCatchupStatus(bool contiguous) = 0;

// This returns the ledger that comes immediately after the LCL (i.e., LCL +
// 1) if CatchupManager has it in its buffer. If not, it doesn’t return any
// ledger. This method doesn’t tell if the buffer is empty or if it's ever
// heard of LCL + 1. It only tells if CatchupManager has LCL + 1 in its
// buffer right now.
// 1) if LedgerApplyManager has it in its buffer. If not, it doesn’t return
// any ledger. This method doesn’t tell if the buffer is empty or if it's
// ever heard of LCL + 1. It only tells if LedgerApplyManager has LCL + 1 in
// its buffer right now.
virtual std::optional<LedgerCloseData>
maybeGetNextBufferedLedgerToApply() = 0;

virtual std::optional<LedgerCloseData> maybeGetLargestBufferedLedger() = 0;

// This returns the largest ledger sequence that CatchupManager has ever
// This returns the largest ledger sequence that LedgerApplyManager has ever
// heard of.
virtual uint32_t getLargestLedgerSeqHeard() const = 0;

Expand All @@ -118,7 +118,7 @@ class CatchupManager

virtual CatchupMetrics const& getCatchupMetrics() = 0;

virtual ~CatchupManager(){};
virtual ~LedgerApplyManager(){};

virtual void historyArchiveStatesDownloaded(uint32_t num = 1) = 0;
virtual void ledgersVerified(uint32_t num = 1) = 0;
Expand Down
Loading

0 comments on commit 70e4151

Please sign in to comment.