Skip to content

Commit 4ace1fd

Browse files
committed
Allow bucket-apply before Application::start()
1 parent 00f54c0 commit 4ace1fd

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/catchup/ApplyBucketsWork.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ class TempLedgerVersionSetter : NonMovableOrCopyable
5454
ApplyBucketsWork::ApplyBucketsWork(
5555
Application& app,
5656
std::map<std::string, std::shared_ptr<LiveBucket>> const& buckets,
57-
HistoryArchiveState const& applyState, uint32_t maxProtocolVersion)
57+
HistoryArchiveState const& applyState, uint32_t maxProtocolVersion,
58+
bool waitForLedgerManager)
5859
: Work(app, "apply-buckets", BasicWork::RETRY_NEVER)
5960
, mBuckets(buckets)
6061
, mApplyState(applyState)
@@ -64,6 +65,7 @@ ApplyBucketsWork::ApplyBucketsWork(
6465
, mCounters(app.getClock().now())
6566
, mIsApplyInvariantEnabled(
6667
app.getInvariantManager().isBucketApplyInvariantEnabled())
68+
, mWaitForLedgerManager{waitForLedgerManager}
6769
, mLedgerManagerReadyTimer(app)
6870
{
6971
}
@@ -236,8 +238,8 @@ ApplyBucketsWork::doWork()
236238

237239
if (!mAssumeStateWork)
238240
{
239-
if (mApp.getLedgerManager().getState() ==
240-
LedgerManager::LM_BOOTING_STATE)
241+
if (mWaitForLedgerManager && mApp.getLedgerManager().getState() ==
242+
LedgerManager::LM_BOOTING_STATE)
241243
{
242244
waitForLedgerManager();
243245
return BasicWork::State::WORK_WAITING;

src/catchup/ApplyBucketsWork.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,16 @@ class ApplyBucketsWork : public Work
5353
void startBucket();
5454
void prepareForNextBucket();
5555

56+
bool const mWaitForLedgerManager;
5657
VirtualTimer mLedgerManagerReadyTimer;
5758
void waitForLedgerManager();
5859

5960
public:
6061
ApplyBucketsWork(
6162
Application& app,
6263
std::map<std::string, std::shared_ptr<LiveBucket>> const& buckets,
63-
HistoryArchiveState const& applyState, uint32_t maxProtocolVersion);
64+
HistoryArchiveState const& applyState, uint32_t maxProtocolVersion,
65+
bool waitForLedgerManager = true);
6466
~ApplyBucketsWork() = default;
6567

6668
std::string getStatus() const override;

src/main/ApplicationUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ applyBucketsForLCL(Application& app)
186186

187187
std::map<std::string, std::shared_ptr<LiveBucket>> buckets;
188188
auto work = app.getWorkScheduler().scheduleWork<ApplyBucketsWork>(
189-
buckets, has, maxProtocolVersion);
189+
buckets, has, maxProtocolVersion, false);
190190

191191
while (app.getClock().crank(true) && !work->isDone())
192192
;

0 commit comments

Comments
 (0)