Make parallel apply compatible with RUN_STANDALONE#5146
Open
SirTyson wants to merge 2 commits intostellar:masterfrom
Open
Make parallel apply compatible with RUN_STANDALONE#5146SirTyson wants to merge 2 commits intostellar:masterfrom
SirTyson wants to merge 2 commits intostellar:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes RUN_STANDALONE compatible with parallel/background ledger apply so that more unit tests (and apply-load runs) can exercise the parallel apply path.
Changes:
- Allow
RUN_STANDALONEto usePARALLEL_LEDGER_APPLYby removing the standalone restriction and updating manual-close/test flows to wait for background apply completion. - Prevent virtual time from advancing while background-thread actions are queued (to avoid time jumps that can delay processing apply results).
- Adjust several tests/configs to be robust under background apply (timeouts, draining apply before shutdown, disabling parallel apply in tests that mutate headers).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util/Timer.cpp | Avoid virtual-time fast-forward when background-thread actions are pending. |
| src/overlay/test/TCPPeerTests.cpp | Increase timeouts to account for extra main-thread callbacks under background apply. |
| src/main/Config.cpp | Stop auto-disabling parallel apply in standalone; disable only for in-memory SQLite. |
| src/main/CommandLine.cpp | Force parallel apply in apply-load max-sac-tps mode. |
| src/main/ApplicationImpl.cpp | In standalone manual-close, crank until background apply finishes and LCL advances. |
| src/ledger/test/LedgerCloseMetaStreamTests.cpp | Drain background apply before shutdown for consistent debug txset/LCL reads. |
| src/ledger/LedgerManagerImpl.cpp | Improve test-only error for txset mismatch on background apply thread. |
| src/invariant/test/ConservationOfLumensTests.cpp | Disable parallel apply in tests that directly mutate the ledger header. |
| src/history/test/HistoryTests.cpp | Wait for background apply to catch up after externalization in catchup simulation. |
| src/herder/test/TransactionQueueTests.cpp | Wait for background apply to finish before asserting queue state. |
| src/herder/test/HerderTests.cpp | Wait for background apply to finish after externalization helper. |
| docs/apply-load-max-sac-tps.cfg | Enable parallel apply for the max-sac-tps apply-load config. |
790b206 to
576c1d6
Compare
Contributor
marta-lokhova
left a comment
There was a problem hiding this comment.
Thanks, this is a helpful change! Looks good overall, I just had a couple of suggestions and a question.
576c1d6 to
b601bbc
Compare
marta-lokhova
previously approved these changes
Feb 19, 2026
b601bbc to
1dde4b8
Compare
marta-lokhova
previously approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This change makes RUN_STANDALONE compatible with parallel ledger apply. There are a few motivations for this. First, many tests enable
RUN_STANDALONE, so we silently disable parallel apply in many unit tests. This change increases test coverage (and we'll need to do it eventually anyway if we make parallel apply the unconditional default). 2nd, this allows us to use parallel apply in apply load tests, which significantly reduces variance of tests like max-sac-tps test.This touches a few tests I'm not very familiar with (and was AI assisted), but it looks reasonable to me and CI passes, but I'd like for someone more familiar with these unit tests to take a look.
Checklist
clang-formatv8.0.0 (viamake formator the Visual Studio extension)