cmd/utils: add --exec.serial flag to clamp workers to 1#20853
Merged
Conversation
Follow-up to #20797. Adds a single-purpose boolean that forces serial execution by clamping the parallel executor's worker count to 1 — wins over both --exec.workers and EXEC3_WORKERS. Cleaner than `--exec.workers=1` because it states intent ("force serial") at the call site rather than relying on a magic value, and it can't be accidentally undone by a stale EXEC3_WORKERS env var that gets re-read by tooling. Use case: like-for-like baseline comparisons against the parallel executor (devnet A/B runs, profiling cold paths) where the operator explicitly wants serial irrespective of any other knob. Wiring: applied AFTER --exec.workers in SetEthConfig, so: --exec.serial=true → workers=1 --exec.workers=12 --exec.serial=true → workers=1 (serial wins) --exec.workers=12 → workers=12 --exec.serial=false (default) → no override Test: TestExecPerfFlags_OverrideDbg covers serial-true, serial-vs-workers precedence, and serial-false-leaves-untouched. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an explicit --exec.serial CLI flag to force serial execution in the parallel executor by clamping worker count to 1, overriding both --exec.workers and EXEC3_WORKERS when enabled.
Changes:
- Introduce
ExecSerialFlag(--exec.serial) and apply it inSetEthConfigto clamp executor workers to 1 whentrue. - Register the new flag in the Erigon binary’s
DefaultFlags. - Extend
TestExecPerfFlags_OverrideDbgwith subtests covering serial clamping and precedence over--exec.workers.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
node/cli/default_flags.go |
Registers --exec.serial alongside other --exec.* perf flags so it shows up in --help and is recognized by the main binary. |
cmd/utils/flags.go |
Defines ExecSerialFlag and enforces precedence in SetEthConfig by clamping worker count to 1 when enabled. |
cmd/utils/flags_test.go |
Adds subtests validating --exec.serial behavior and its override precedence. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+209
to
+210
| // flags are applied in declaration order (workers first, then serial), | ||
| // so serial should override workers regardless of CLI argument order. |
yperbasis
approved these changes
Apr 28, 2026
mh0lt
added a commit
that referenced
this pull request
Apr 28, 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.
Summary
Follow-up to #20797. Adds a single-purpose boolean — `--exec.serial` — that forces serial execution by clamping the parallel executor's worker count to 1. Wins over both `--exec.workers` and `EXEC3_WORKERS`.
Why a separate flag rather than just `--exec.workers=1`
Precedence (resolved in `SetEthConfig`)
Test plan
Files touched
~35 LOC including tests.