diff --git a/src/bucket/BucketList.cpp b/src/bucket/BucketList.cpp index e714280a7e..aa3820dd47 100644 --- a/src/bucket/BucketList.cpp +++ b/src/bucket/BucketList.cpp @@ -447,6 +447,21 @@ BucketList::getLevel(uint32_t i) return mLevels.at(i); } +#ifdef BUILD_TESTS +void +BucketList::resolveAllFutures() +{ + ZoneScoped; + for (auto& level : mLevels) + { + if (level.getNext().isMerging()) + { + level.getNext().resolve(); + } + } +} +#endif + void BucketList::resolveAnyReadyFutures() { diff --git a/src/bucket/BucketList.h b/src/bucket/BucketList.h index 09549ac1ad..5599132f4c 100644 --- a/src/bucket/BucketList.h +++ b/src/bucket/BucketList.h @@ -502,6 +502,12 @@ class BucketList // HistoryArchiveStates, that can cause repeated merges when re-activated. void resolveAnyReadyFutures(); +#ifdef BUILD_TESTS + // Same as the function above, except we don't check if the buckets are + // done merging. + void resolveAllFutures(); +#endif + // returns true if levels [0, maxLevel] are resolved bool futuresAllResolved(uint32_t maxLevel = kNumLevels - 1) const; diff --git a/src/main/CommandLine.cpp b/src/main/CommandLine.cpp index c01005ce39..be58b992c2 100644 --- a/src/main/CommandLine.cpp +++ b/src/main/CommandLine.cpp @@ -1884,6 +1884,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 = @@ -1926,6 +1927,10 @@ runApplyLoad(CommandLineArgs const& args) for (size_t i = 0; i < 100; ++i) { + app.getBucketManager().getBucketList().resolveAllFutures(); + releaseAssert(app.getBucketManager() + .getBucketList() + .futuresAllResolved()); al.benchmark(); } diff --git a/src/simulation/test/LoadGeneratorTests.cpp b/src/simulation/test/LoadGeneratorTests.cpp index b488fbaf8e..b6948485c4 100644 --- a/src/simulation/test/LoadGeneratorTests.cpp +++ b/src/simulation/test/LoadGeneratorTests.cpp @@ -843,7 +843,6 @@ TEST_CASE("apply load", "[loadgen][applyload]") VirtualClock clock(VirtualClock::REAL_TIME); auto app = createTestApplication(clock, cfg); - auto const& lm = app->getLedgerManager(); uint64_t ledgerMaxInstructions = 500'000'000; uint64_t ledgerMaxReadLedgerEntries = 2000; @@ -871,6 +870,10 @@ TEST_CASE("apply load", "[loadgen][applyload]") cpuInsRatioExclVm.Clear(); for (size_t i = 0; i < 100; ++i) { + app->getBucketManager().getBucketList().resolveAllFutures(); + releaseAssert( + app->getBucketManager().getBucketList().futuresAllResolved()); + al.benchmark(); } REQUIRE(al.successRate() - 1.0 < std::numeric_limits::epsilon());