Skip to content

Commit

Permalink
Wait on merges in apply-load
Browse files Browse the repository at this point in the history
  • Loading branch information
sisuresh committed Nov 8, 2024
1 parent 7023383 commit 57087e7
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/main/CheckMergingWork.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2024 Stellar Development Foundation and contributors. Licensed
// under the Apache License, Version 2.0. See the COPYING file at the root
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0

#include "main/CheckMergingWork.h"
#include "bucket/BucketList.h"
#include "bucket/BucketManager.h"

namespace stellar
{

CheckMergingWork::CheckMergingWork(Application& app)
: BasicWork(app, "check-merging-work", BasicWork::RETRY_NEVER)
{
}

BasicWork::State
CheckMergingWork::onRun()
{
auto& bl = mApp.getBucketManager().getBucketList();
bl.resolveAnyReadyFutures();
if (bl.futuresAllResolved())
{
return State::WORK_SUCCESS;
}
return State::WORK_RUNNING;
}

bool
CheckMergingWork::onAbort()
{
return mApp.getBucketManager().getBucketList().futuresAllResolved();
}

}
21 changes: 21 additions & 0 deletions src/main/CheckMergingWork.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2024 Stellar Development Foundation and contributors. Licensed
// under the Apache License, Version 2.0. See the COPYING file at the root
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0

#pragma once

#include "work/BasicWork.h"

namespace stellar
{

class CheckMergingWork : public BasicWork
{
public:
CheckMergingWork(Application& app);

protected:
State onRun() override;
bool onAbort() override;
};
}
7 changes: 7 additions & 0 deletions src/main/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "ledger/LedgerManager.h"
#include "main/Application.h"
#include "main/ApplicationUtils.h"
#include "main/CheckMergingWork.h"
#include "main/Config.h"
#include "main/Diagnostics.h"
#include "main/ErrorMessages.h"
Expand Down Expand Up @@ -1884,6 +1885,7 @@ runApplyLoad(CommandLineArgs const& args)
[&] {
auto config = configOption.getConfig();
config.RUN_STANDALONE = true;
config.MANUAL_CLOSE = true;
config.USE_CONFIG_FOR_GENESIS = true;
config.TESTING_UPGRADE_MAX_TX_SET_SIZE = 1000;
config.LEDGER_PROTOCOL_VERSION =
Expand Down Expand Up @@ -1926,6 +1928,11 @@ runApplyLoad(CommandLineArgs const& args)

for (size_t i = 0; i < 100; ++i)
{
auto checkMergingWork =
app.getWorkScheduler().executeWork<CheckMergingWork>();
releaseAssert(checkMergingWork->getState() ==
BasicWork::State::WORK_SUCCESS);

al.benchmark();
}

Expand Down

0 comments on commit 57087e7

Please sign in to comment.