Skip to content

[r3.5] cmd/integration: collate state files incrementally in parallel stage_exec - #22262

Merged
AskAlexSharov merged 1 commit into
release/3.5from
sudeep/stage-exec-parallel-build-files
Jul 6, 2026
Merged

[r3.5] cmd/integration: collate state files incrementally in parallel stage_exec#22262
AskAlexSharov merged 1 commit into
release/3.5from
sudeep/stage-exec-parallel-build-files

Conversation

@sudeepdino008

Copy link
Copy Markdown
Member

Problem

integration stage_exec on the parallel execution path (EXEC3_PARALLEL=true) never triggers step collation, so every step stays in the DB. stepsInDB grows monotonically to the full run and chaindata balloons. A later offline finalize (seg retireagg.BuildFiles) then has to build each step by scanning the whole DB — effectively O(n²).

The serial path collates implicitly during execution, keeping the DB small.

Observed on a mainnet run to step 260 (block 4,665,800):

serial (3.4-style) parallel (before fix)
[agg] building during exec 482 0
stepsInDB at end ~2 260
chaindata after exec 34 GB 220 GB
offline seg retire fast ~37 min/step × 260 ≈ 6 days

Fix

Kick agg.BuildFilesInBackground(agg.EndTxNumMinimax() + agg.StepSize()) each commit in the stageExec loop — the same call the node executor makes in its CommitCycle (execution/execmodule/executor.go). The loop's existing PruneExecutionStagePruneSmallBatches then reclaims the collated steps, so the DB stays small on the parallel path too (build alone collates; build + the existing prune shrinks).

The buildFilesInBackground gate does not depend on LockWorkersEditing, so the call is effective during offline execution.

Testing

Behavior fix in the integration tool (not easily unit-testable without a full historical exec). Verified by the measurements above: before, parallel stage_exec leaves 260 steps in the DB; the change makes it collate/prune incrementally like the serial path and the node.

…exec

The parallel executor never triggers step collation during stage_exec, so
every step accumulates in the DB (chaindata grows unbounded) and a later
offline finalize has to build each step by scanning the whole DB — O(n^2).
The serial executor collates implicitly, keeping the DB small.

Kick BuildFilesInBackground each commit in the stageExec loop (as the node's
executor.go CommitCycle does); the loop's existing PruneSmallBatches then
reclaims the collated steps, so the DB stays small on the parallel path too.
@AskAlexSharov
AskAlexSharov enabled auto-merge (squash) July 6, 2026 10:34
@AskAlexSharov
AskAlexSharov merged commit 63b420e into release/3.5 Jul 6, 2026
89 of 90 checks passed
@AskAlexSharov
AskAlexSharov deleted the sudeep/stage-exec-parallel-build-files branch July 6, 2026 10:38
yperbasis added a commit that referenced this pull request Jul 10, 2026
Adds the **v3.5.1** release notes to `ChangeLog.md`, following the
v3.4.1–v3.4.4 point-release format (codename **Tidal Tails**, kept from
3.5.0; date left as `TBD` pending the release).

Scope: user-facing **Bugfixes** and **Improvements** merged to
`release/3.5` since the `v3.5.0` tag. Each entry cites the `[r3.5]` PR
that landed on the branch and credits the original fix author, matching
the existing point-release style.

The six issues closed in [milestone
3.5.1](https://github.com/erigontech/erigon/milestone/78) are all
covered: #21992 & #22101 (commitment consistency), #22013
(`stage_custom_trace` prune), #22275 (snapshot reset), #22337 (Bellatrix
reconstruction loop), #22351 (forkchoice `GetHead` stall).

Deliberately omitted as minor/internal/tooling/docs-only:
- `cmd/integration` / `seg` build tweaks (#22137, #22262), QA sync-wait
bump (#22280), docs & changelog commits (#22062, #22068, #22090),
downloader concurrency hardening (#22319).
- The **net-zero** rcache pair — #22047 (bump rcache domain to v3.1) and
its revert #22207 — cancels out, so it produces no 3.5.0→3.5.1 change.

Opened as a **draft**: fill in the release date on tag, and confirm
nothing else is expected to land in 3.5.1 before finalizing.

_No `make lint` run — the diff is markdown-only (`ChangeLog.md`), which
golangci-lint does not scan._
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants