From d8096685eedc76f6d1abe27106ff78fea4c2a485 Mon Sep 17 00:00:00 2001 From: Nicholas Dudfield Date: Wed, 23 Sep 2026 10:02:51 +0700 Subject: [PATCH] test: drop ConcurrentLedgerSave_test from the dev backport It depends on a jtx helper (saveValidatedLedger) that exists only on the feature-export-rng lineage. The production fix it covers stays; the test can return with the helper if that is ported. --- src/test/rdb/ConcurrentLedgerSave_test.cpp | 135 --------------------- 1 file changed, 135 deletions(-) delete mode 100644 src/test/rdb/ConcurrentLedgerSave_test.cpp diff --git a/src/test/rdb/ConcurrentLedgerSave_test.cpp b/src/test/rdb/ConcurrentLedgerSave_test.cpp deleted file mode 100644 index be0569f9a9..0000000000 --- a/src/test/rdb/ConcurrentLedgerSave_test.cpp +++ /dev/null @@ -1,135 +0,0 @@ -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace ripple { -namespace test { - -class ConcurrentLedgerSave_test : public beast::unit_test::suite -{ - void - run() override - { - testcase( - "independent database pairs save without sharing SQL formatters"); - using namespace jtx; - Env env(*this); - Account const alice("alice"); - Account const bob("bob"); - env.fund(XRP(10000), alice, bob); - env.close(); - - constexpr std::size_t writers = 4; - constexpr int savesPerWriter = 50; - std::array, writers> ledgers; - std::array transactionIDs; - for (std::size_t i = 0; i < writers; ++i) - { - env(pay(alice, bob, drops(i + 1))); - transactionIDs[i] = env.tx()->getTransactionID(); - env.close(); - ledgers[i] = env.closed(); - } - env.app().getJobQueue().rendezvous(); - - // The production save function accepts independent database handles. - // Separate connections make its local-storage ownership observable - // without depending on multi-Application construction seams. - auto const setup = setup_DatabaseCon(env.app().config()); - auto const journal = env.app().journal("ConcurrentLedgerSave"); - std::array, writers> ledgerDBs; - std::array, writers> transactionDBs; - for (std::size_t i = 0; i < writers; ++i) - { - ledgerDBs[i] = std::make_unique( - setup, LgrDBName, setup.lgrPragma, LgrDBInit, journal); - transactionDBs[i] = std::make_unique( - setup, TxDBName, setup.txPragma, TxDBInit, journal); - } - - std::promise ready; - auto start = ready.get_future().share(); - std::array errors; - std::array saved{}; - std::array threads; - for (std::size_t i = 0; i < writers; ++i) - threads[i] = std::thread([&, i] { - start.wait(); - try - { - for (int attempt = 0; attempt < savesPerWriter; ++attempt) - { - if (!detail::saveValidatedLedger( - *ledgerDBs[i], - *transactionDBs[i], - env.app(), - ledgers[i], - false)) - { - errors[i] = "save returned false"; - break; - } - ++saved[i]; - } - } - catch (std::exception const& e) - { - errors[i] = e.what(); - } - }); - ready.set_value(); - for (auto& thread : threads) - thread.join(); - - for (std::size_t i = 0; i < writers; ++i) - { - BEAST_EXPECTS(errors[i].empty(), errors[i]); - BEAST_EXPECT(saved[i] == savesPerWriter); - auto const expectedSeq = ledgers[i]->info().seq; - auto ledgerSession = ledgerDBs[i]->checkoutDb(); - auto transactionSession = transactionDBs[i]->checkoutDb(); - std::size_t rows = 0; - std::uint32_t minSeq = 0, maxSeq = 0; - *ledgerSession << "SELECT COUNT(*), MIN(LedgerSeq), MAX(LedgerSeq) " - "FROM Ledgers;", - soci::into(rows), soci::into(minSeq), soci::into(maxSeq); - BEAST_EXPECT(rows == 1); - BEAST_EXPECT(minSeq == expectedSeq && maxSeq == expectedSeq); - - std::string hash; - *ledgerSession << "SELECT LedgerHash FROM Ledgers;", - soci::into(hash); - BEAST_EXPECT(hash == to_string(ledgers[i]->info().hash)); - - *transactionSession << "SELECT COUNT(*), MIN(LedgerSeq), " - "MAX(LedgerSeq) FROM Transactions;", - soci::into(rows), soci::into(minSeq), soci::into(maxSeq); - BEAST_EXPECT(rows == 1); - BEAST_EXPECT(minSeq == expectedSeq && maxSeq == expectedSeq); - std::string txid; - *transactionSession << "SELECT TransID FROM Transactions;", - soci::into(txid); - BEAST_EXPECT(txid == to_string(transactionIDs[i])); - - *transactionSession << "SELECT COUNT(*), MIN(LedgerSeq), " - "MAX(LedgerSeq) FROM AccountTransactions;", - soci::into(rows), soci::into(minSeq), soci::into(maxSeq); - BEAST_EXPECT(rows == 2); - BEAST_EXPECT(minSeq == expectedSeq && maxSeq == expectedSeq); - } - } -}; - -BEAST_DEFINE_TESTSUITE(ConcurrentLedgerSave, rdb, ripple); - -} // namespace test -} // namespace ripple