Repository navigation
Clarify background ledger apply flow in comments and rename some variables - #5432
marta-lokhova merged 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Renames ledger-close internals to reflect the background ledger-apply pipeline and clarifies state ownership and completion flow.
Changes:
- Renames apply-thread APIs, configuration helpers, and buffered-ledger state.
- Renames ledger completion methods and test hooks.
- Expands concurrency and ledger-state documentation.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
src/util/test/TimerTests.cpp |
Updates apply-thread API usage. |
src/transactions/TransactionFrameBase.h |
Revises parallel-apply documentation. |
src/main/Config.h |
Renames and documents the configuration predicate. |
src/main/Config.cpp |
Implements the renamed predicate. |
src/main/Application.h |
Renames apply-thread interfaces. |
src/main/ApplicationImpl.h |
Renames apply-thread members. |
src/main/ApplicationImpl.cpp |
Updates thread lifecycle and dispatch implementation. |
src/ledger/LedgerTxn.cpp |
Uses the renamed configuration predicate. |
src/ledger/LedgerManager.h |
Documents pipeline states and renames completion API. |
src/ledger/LedgerManagerImpl.h |
Renames completion members and adds locking notes. |
src/ledger/LedgerManagerImpl.cpp |
Renames completion flow and expands concurrency documentation. |
src/history/test/HistoryTests.cpp |
Updates buffered-ledger terminology. |
src/history/HistoryManager.h |
Updates buffered-ledger reference. |
src/herder/test/HerderTests.cpp |
Updates completion hook and comments. |
src/herder/HerderImpl.cpp |
Uses the renamed configuration predicate. |
src/catchup/LedgerApplyManagerImpl.h |
Renames buffered-ledger state and helpers. |
src/catchup/LedgerApplyManagerImpl.cpp |
Applies buffered-ledger and apply-thread renames. |
src/catchup/CatchupWork.cpp |
Updates buffered-ledger comments. |
Suppressed comments (1)
src/ledger/LedgerManagerImpl.cpp:1636
- This second reference also uses the retired
ledger-closethread terminology. It should useledger applyso the stated invariant matchesmLedgerApplyThreadand the rest of the updated comment.
// * Application is strictly serialized: there is exactly one ledger-close
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
b6db839 to
9dea237
Compare
9dea237 to
76cdbf3
Compare
76cdbf3 to
11f38d3
Compare
f3bf40e to
b182899
Compare
b182899 to
a3bf440
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
Suppressed comments (1)
src/ledger/LedgerManagerImpl.cpp:1567
- This safety claim overlooks
publishSorobanMetrics(), which accessesmApplyStateand drainsSorobanMetricsbatches from the main thread. With the newly documented pipeline,applyLedger(N+1)can concurrently obtain a batch reference and mutate it afterflushApplyMetricsBatches()moves and destroys that batch; ledger-wide atomics can also be reset while N+1 increments them. This is a concrete data race and can lose/corrupt metrics or dereference freed storage. Snapshot/publish ledger N's metrics before the apply thread starts N+1, or make batch draining and mutation properly synchronized before describing completion as safe.
// safe here because every input is one of:
// * appliedLedgerState: an immutable snapshot shared with ApplyState; both
// threads may read it concurrently, while neither mutates it;
// * main-thread-only state: mCurrentlyApplyingLedger, the LM state machine,
// Herder notification.
dmkozh
left a comment
There was a problem hiding this comment.
Thanks, this looks much more clear than what we had (though I'm admittedly a bit biased as I've just had a refresher on how this is supposed to work, so it might seem more clear than it would have been 2 days ago).
No description provided.