Skip to content

Commit 8749846

Browse files
committed
Introduce new experimental parallel ledger close flag
1 parent de84fd6 commit 8749846

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

src/ledger/LedgerManagerImpl.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ class LedgerManagerImpl : public LedgerManager
9494
std::unique_ptr<LedgerCloseMetaFrame> const& ledgerCloseMeta,
9595
uint32_t initialLedgerVers);
9696

97-
void storeCurrentLedger(LedgerHeader const& header, bool storeHeader, bool appendToCheckpoint);
97+
void storeCurrentLedger(LedgerHeader const& header, bool storeHeader,
98+
bool appendToCheckpoint);
9899
static void
99100
prefetchTransactionData(AbstractLedgerTxnParent& rootLtx,
100101
std::vector<TransactionFrameBasePtr> const& txs,

src/ledger/LedgerTxn.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -2597,6 +2597,11 @@ LedgerTxnRoot::Impl::addChild(AbstractLedgerTxn& child, TransactionMode mode)
25972597

25982598
if (mode == TransactionMode::READ_WRITE_WITH_SQL_TXN)
25992599
{
2600+
if (mApp.getConfig().EXPERIMENTAL_PARALLEL_LEDGER_CLOSE)
2601+
{
2602+
mSession =
2603+
std::make_unique<soci::session>(mApp.getDatabase().getPool());
2604+
}
26002605
mTransaction =
26012606
std::make_unique<soci::transaction>(getSession().session());
26022607
}

src/main/Config.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ Config::Config() : NODE_SEED(SecretKey::random())
164164
CATCHUP_RECENT = 0;
165165
EXPERIMENTAL_PRECAUTION_DELAY_META = false;
166166
EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING = false;
167+
EXPERIMENTAL_PARALLEL_LEDGER_CLOSE = false;
167168
DEPRECATED_SQL_LEDGER_STATE = false;
168169
BUCKETLIST_DB_INDEX_PAGE_SIZE_EXPONENT = 14; // 2^14 == 16 kb
169170
BUCKETLIST_DB_INDEX_CUTOFF = 20; // 20 mb
@@ -1071,6 +1072,10 @@ Config::processConfig(std::shared_ptr<cpptoml::table> t)
10711072
EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING =
10721073
readBool(item);
10731074
}},
1075+
{"EXPERIMENTAL_PARALLEL_LEDGER_CLOSE",
1076+
[&]() {
1077+
EXPERIMENTAL_PARALLEL_LEDGER_CLOSE = readBool(item);
1078+
}},
10741079
{"BACKGROUND_EVICTION_SCAN",
10751080
[&]() { BACKGROUND_EVICTION_SCAN = readBool(item); }},
10761081
// TODO: Flag is no longer supported, remove in next release.
@@ -1989,6 +1994,10 @@ Config::logBasicInfo()
19891994
"EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING="
19901995
"{}",
19911996
EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING ? "true" : "false");
1997+
LOG_INFO(DEFAULT_LOG,
1998+
"EXPERIMENTAL_PARALLEL_LEDGER_CLOSE="
1999+
"{}",
2000+
EXPERIMENTAL_PARALLEL_LEDGER_CLOSE ? "true" : "false");
19922001
}
19932002

19942003
void

src/main/Config.h

+3
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ class Config : public std::enable_shared_from_this<Config>
409409
// Enable parallel processing of overlay operations (experimental)
410410
bool EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING;
411411

412+
// Enable parallel block application (experimental)
413+
bool EXPERIMENTAL_PARALLEL_LEDGER_CLOSE;
414+
412415
// When set to true, BucketListDB indexes are persisted on-disk so that the
413416
// BucketList does not need to be reindexed on startup. Defaults to true.
414417
// This should only be set to false for testing purposes

src/test/TxTests.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -591,17 +591,12 @@ closeLedgerOn(Application& app, uint32 ledgerSeq, time_t closeTime,
591591
{
592592
app.getHerder().externalizeValue(txSet, ledgerSeq, closeTime,
593593
emptyUpgradeSteps);
594-
<<<<<<< HEAD
595-
596-
auto& lm = static_cast<LedgerManagerImpl&>(app.getLedgerManager());
597-
auto z1 = lm.mLatestTxResultSet;
598-
=======
599594
while (app.getLedgerManager().getLastClosedLedgerNum() != ledgerSeq)
600595
{
601596
app.getClock().crank(true);
602597
}
603-
auto z1 = getTransactionHistoryResults(app.getDatabase(), ledgerSeq);
604-
>>>>>>> a5c5de098 (Allow ledger close path to run async during externalize)
598+
auto& lm = static_cast<LedgerManagerImpl&>(app.getLedgerManager());
599+
auto z1 = lm.mLatestTxResultSet;
605600

606601
REQUIRE(app.getLedgerManager().getLastClosedLedgerNum() == ledgerSeq);
607602

0 commit comments

Comments
 (0)