Skip to content

refactor(engine): rename apply_chunk_parallel to apply_one_chunk for clarity (RJN-2) - #4660

Merged
oferchen merged 1 commit into
masterfrom
refactor/engine-rename-apply-one-chunk-rjn2
May 21, 2026
Merged

oferchen merged 1 commit into
masterfrom
refactor/engine-rename-apply-one-chunk-rjn2

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Per the RJN-1 audit (#4656), the name `apply_chunk_parallel` was misleading: the function uses `rayon::join(verify, || ())` with a no-op second closure, which schedules a single chunk's verify on a rayon worker but does NOT parallelize across chunks. Real multi-chunk parallelism lives in `apply_batch_parallel`.

This PR renames to `apply_one_chunk` and adds a rustdoc paragraph clarifying the semantics. RJN-3 (batched fan-out at the receiver) is deferred until receiver wiring exists - per RJN-1, there are zero production callers today.

Scope

  • Rename across 17 call sites (1 definition + 12 unit tests in `parallel_apply.rs` + 2 stress tests in `parallel_apply_concurrent.rs` + 1 drop-ordering test in `arc_drain_panic_recovery.rs` + 1 test in `chunk_builder.rs`).
  • No semantic code changes; no new deps; no `#[allow(...)]` waivers.

Test plan

  • `cargo fmt --all` clean
  • `cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings` clean
  • `cargo nextest run -p engine --features parallel-receive-delta` no regression
  • `cargo nextest run -p transfer --features 'parallel-receive-delta incremental-flist'` no regression

Per RJN-1 audit (PR #4656): the name `apply_chunk_parallel` was
misleading. The function uses `rayon::join(verify, || ())` with a
no-op second closure - it schedules a single chunk's verify on a
rayon worker but does NOT parallelize across chunks. The actual
multi-chunk parallelism lives in `apply_batch_parallel` via
`chunks.into_par_iter()`.

Rename to `apply_one_chunk` to reflect actual semantics. Update all
17 call sites (per RJN-1: 1 definition + 12 unit tests in
parallel_apply.rs + 2 stress tests in parallel_apply_concurrent.rs
+ 1 drop-ordering test in arc_drain_panic_recovery.rs + 1 test in
chunk_builder.rs). Add rustdoc paragraph clarifying that it is a
single-chunk scheduling primitive, not cross-chunk parallelism, and
direct callers wanting multi-chunk parallel verify to
`apply_batch_parallel(Vec<DeltaChunk>)`.

RJN-3 (batched fan-out at the receiver) deferred until receiver
wiring exists - currently zero production callers per audit.

No semantic code changes. Pure rename + rustdoc edit.
@oferchen
oferchen merged commit 9a60a98 into master May 21, 2026
54 of 55 checks passed
@oferchen
oferchen deleted the refactor/engine-rename-apply-one-chunk-rjn2 branch May 21, 2026 10:15
oferchen added a commit that referenced this pull request May 21, 2026
…-2 rename (#4676)

RJN-2 (PR #4660, merged) chose the rename path over the fanout-refactor path,
discharging the RJN-1 audit (PR #4656, merged) with apply_chunk_parallel ->
apply_one_chunk plus a rustdoc redirect to apply_batch_parallel. RJN-3
(implement fanout) and RJN-4 (bench scheduler shape) were the "if RJN-2 chose
refactor" branch that did not get taken; this doc closes both.

- RJN-3 stays closed: zero production callers of apply_one_chunk; the real
  multi-chunk win sits in apply_batch_parallel, where ABW-1 (PR #4670) already
  recommended deferring per its quantified 1.03x-1.50x speedup range; the
  ABW-2/3/4 closure doc defers that track pending BR-3j.f (#2508) bench data.
- RJN-4 is N/A: with RJN-3 deferred there is no "after" cell to measure; the
  production-weighted scheduler-shape bench effort belongs in
  parallel_receive_delta_perf via BR-3j.f, not at the per-chunk entry point.
- Re-open conditions: a production caller of apply_one_chunk ships AND
  profiling shows the per-chunk path is hot.

Project memory references project_rayon_join_per_chunk_noop.md and
project_apply_batch_write_serial.md - both observations remain accurate
under the renamed function.
@oferchen
oferchen restored the refactor/engine-rename-apply-one-chunk-rjn2 branch May 21, 2026 14:58
oferchen added a commit that referenced this pull request Aug 24, 2026
…-2) (#4660)

Per RJN-1 audit (PR #4656): the name `apply_chunk_parallel` was
misleading. The function uses `rayon::join(verify, || ())` with a
no-op second closure - it schedules a single chunk's verify on a
rayon worker but does NOT parallelize across chunks. The actual
multi-chunk parallelism lives in `apply_batch_parallel` via
`chunks.into_par_iter()`.

Rename to `apply_one_chunk` to reflect actual semantics. Update all
17 call sites (per RJN-1: 1 definition + 12 unit tests in
parallel_apply.rs + 2 stress tests in parallel_apply_concurrent.rs
+ 1 drop-ordering test in arc_drain_panic_recovery.rs + 1 test in
chunk_builder.rs). Add rustdoc paragraph clarifying that it is a
single-chunk scheduling primitive, not cross-chunk parallelism, and
direct callers wanting multi-chunk parallel verify to
`apply_batch_parallel(Vec<DeltaChunk>)`.

RJN-3 (batched fan-out at the receiver) deferred until receiver
wiring exists - currently zero production callers per audit.

No semantic code changes. Pure rename + rustdoc edit.
oferchen added a commit that referenced this pull request Aug 24, 2026
…-2 rename (#4676)

RJN-2 (PR #4660, merged) chose the rename path over the fanout-refactor path,
discharging the RJN-1 audit (PR #4656, merged) with apply_chunk_parallel ->
apply_one_chunk plus a rustdoc redirect to apply_batch_parallel. RJN-3
(implement fanout) and RJN-4 (bench scheduler shape) were the "if RJN-2 chose
refactor" branch that did not get taken; this doc closes both.

- RJN-3 stays closed: zero production callers of apply_one_chunk; the real
  multi-chunk win sits in apply_batch_parallel, where ABW-1 (PR #4670) already
  recommended deferring per its quantified 1.03x-1.50x speedup range; the
  ABW-2/3/4 closure doc defers that track pending BR-3j.f (#2508) bench data.
- RJN-4 is N/A: with RJN-3 deferred there is no "after" cell to measure; the
  production-weighted scheduler-shape bench effort belongs in
  parallel_receive_delta_perf via BR-3j.f, not at the per-chunk entry point.
- Re-open conditions: a production caller of apply_one_chunk ships AND
  profiling shows the per-chunk path is hot.

Project memory references project_rayon_join_per_chunk_noop.md and
project_apply_batch_write_serial.md - both observations remain accurate
under the renamed function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant