Repository navigation
feat(engine): migrate ParallelDeltaApplier files map to SlotEntry (DG-3.b) - #4841
Merged
Merged
Conversation
…-3.b) Swap the per-file DashMap value type in `ParallelDeltaApplier` from `Arc<SlotBarrier>` to the DG-3.a `SlotEntry` (carrying `Arc<SlotData>` + `Arc<BarrierState>`). Keep `DecrementGuard` and the mod-level `SlotHandle` on their existing `Arc<SlotBarrier>` field types so the race-fix step (DG-3.c) lands as an isolated, bisectable change. `SlotBarrier` is reshaped into a thin transitional adapter that wraps shared `Arc<SlotData>` + `Arc<BarrierState>` handles cloned from a `SlotEntry`. Adapters are minted on demand by `slot_for` via `SlotBarrier::from_entry`; every adapter for the same file shares the same underlying counter, Condvar, and per-file mutex, so the FFB-1 in-flight bookkeeping and FFB-2 barrier semantics are unchanged. `finish_file` retargets the spin-then-yield loop and `Arc::try_unwrap` from the (now-removed) combined Arc onto the entry's payload Arc (`entry.data`). The spin loop stays verbatim per the DG-2.b phasing plan; DG-3.c retires the adapter and DG-4 deletes the spin once DG-3.e's stress test confirms the race window is closed structurally. `flush_workers` reads `entry.barrier` (`Arc<BarrierState>`) directly, and the `flush_workers_survives_spurious_wakeup` test pokes the shared Condvar through the same path. The `concurrent_register_and_dispatch` stress test exercises the public surface and is unaffected. Sequenced per `docs/design/dg-2b-migration-order.md` step DG-3.b.
oferchen
force-pushed
the
feat/dg-3b-files-map-slotentry
branch
from
May 24, 2026 07:35
4651473 to
2576198
Compare
4 tasks
oferchen
added a commit
that referenced
this pull request
May 24, 2026
Routes the per-slot decrement-guard Arc through the bookkeeping
allocation (`BarrierState`) instead of the transitional `SlotBarrier`
adapter. After DG-3.b moved the canonical per-file state into
`SlotEntry { data: Arc<SlotData>, barrier: Arc<BarrierState> }`, the
worker's lingering `DecrementGuard` clone still rode on the adapter
Arc, which - because the adapter clones both inner Arcs on every
`slot_for` call - kept the payload Arc's strong count above 1 across
the flusher's `Arc::try_unwrap` window. DG-3.c retypes
`DecrementGuard.barrier` to `Arc<BarrierState>` so the guard's clone
lives on a strong-count graph disjoint from `Arc<SlotData>`, closing
the cross-Arc release race that the DG-2.a Option-B spec
(`docs/design/dg-2a-option-b-spec.md` section 2) was designed to
eliminate.
`SlotHandle::new` now sources the bookkeeping clone via a new
`SlotBarrier::barrier()` accessor and hands it to the guard; the
handle itself keeps its `Arc<SlotBarrier>` field for the lock path so
the `SlotHandle` retype can sequence independently in a follow-on
DG-3.x task. The now-dead forwarding `SlotBarrier::decrement_inflight`
is removed - the guard talks to `BarrierState::decrement_inflight`
directly. Public API and wire behaviour unchanged.
Related: DG-3.a (#4826), DG-3.b (#4841), DG-2.a spec.
oferchen
added a commit
that referenced
this pull request
May 24, 2026
) Routes the per-slot decrement-guard Arc through the bookkeeping allocation (`BarrierState`) instead of the transitional `SlotBarrier` adapter. After DG-3.b moved the canonical per-file state into `SlotEntry { data: Arc<SlotData>, barrier: Arc<BarrierState> }`, the worker's lingering `DecrementGuard` clone still rode on the adapter Arc, which - because the adapter clones both inner Arcs on every `slot_for` call - kept the payload Arc's strong count above 1 across the flusher's `Arc::try_unwrap` window. DG-3.c retypes `DecrementGuard.barrier` to `Arc<BarrierState>` so the guard's clone lives on a strong-count graph disjoint from `Arc<SlotData>`, closing the cross-Arc release race that the DG-2.a Option-B spec (`docs/design/dg-2a-option-b-spec.md` section 2) was designed to eliminate. `SlotHandle::new` now sources the bookkeeping clone via a new `SlotBarrier::barrier()` accessor and hands it to the guard; the handle itself keeps its `Arc<SlotBarrier>` field for the lock path so the `SlotHandle` retype can sequence independently in a follow-on DG-3.x task. The now-dead forwarding `SlotBarrier::decrement_inflight` is removed - the guard talks to `BarrierState::decrement_inflight` directly. Public API and wire behaviour unchanged. Related: DG-3.a (#4826), DG-3.b (#4841), DG-2.a spec.
This was referenced May 25, 2026
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…-3.b) (#4841) * feat(engine): migrate ParallelDeltaApplier files map to SlotEntry (DG-3.b) Swap the per-file DashMap value type in `ParallelDeltaApplier` from `Arc<SlotBarrier>` to the DG-3.a `SlotEntry` (carrying `Arc<SlotData>` + `Arc<BarrierState>`). Keep `DecrementGuard` and the mod-level `SlotHandle` on their existing `Arc<SlotBarrier>` field types so the race-fix step (DG-3.c) lands as an isolated, bisectable change. `SlotBarrier` is reshaped into a thin transitional adapter that wraps shared `Arc<SlotData>` + `Arc<BarrierState>` handles cloned from a `SlotEntry`. Adapters are minted on demand by `slot_for` via `SlotBarrier::from_entry`; every adapter for the same file shares the same underlying counter, Condvar, and per-file mutex, so the FFB-1 in-flight bookkeeping and FFB-2 barrier semantics are unchanged. `finish_file` retargets the spin-then-yield loop and `Arc::try_unwrap` from the (now-removed) combined Arc onto the entry's payload Arc (`entry.data`). The spin loop stays verbatim per the DG-2.b phasing plan; DG-3.c retires the adapter and DG-4 deletes the spin once DG-3.e's stress test confirms the race window is closed structurally. `flush_workers` reads `entry.barrier` (`Arc<BarrierState>`) directly, and the `flush_workers_survives_spurious_wakeup` test pokes the shared Condvar through the same path. The `concurrent_register_and_dispatch` stress test exercises the public surface and is unaffected. Sequenced per `docs/design/dg-2b-migration-order.md` step DG-3.b. * fix(engine): drop unused SlotBarrier::wait_until_idle adapter (DG-3.b)
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
) Routes the per-slot decrement-guard Arc through the bookkeeping allocation (`BarrierState`) instead of the transitional `SlotBarrier` adapter. After DG-3.b moved the canonical per-file state into `SlotEntry { data: Arc<SlotData>, barrier: Arc<BarrierState> }`, the worker's lingering `DecrementGuard` clone still rode on the adapter Arc, which - because the adapter clones both inner Arcs on every `slot_for` call - kept the payload Arc's strong count above 1 across the flusher's `Arc::try_unwrap` window. DG-3.c retypes `DecrementGuard.barrier` to `Arc<BarrierState>` so the guard's clone lives on a strong-count graph disjoint from `Arc<SlotData>`, closing the cross-Arc release race that the DG-2.a Option-B spec (`docs/design/dg-2a-option-b-spec.md` section 2) was designed to eliminate. `SlotHandle::new` now sources the bookkeeping clone via a new `SlotBarrier::barrier()` accessor and hands it to the guard; the handle itself keeps its `Arc<SlotBarrier>` field for the lock path so the `SlotHandle` retype can sequence independently in a follow-on DG-3.x task. The now-dead forwarding `SlotBarrier::decrement_inflight` is removed - the guard talks to `BarrierState::decrement_inflight` directly. Public API and wire behaviour unchanged. Related: DG-3.a (#4826), DG-3.b (#4841), DG-2.a spec.
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
DG-3.b of the Option-B migration. Swaps the
ParallelDeltaApplier::filesDashMap value type from
Arc<SlotBarrier>toSlotEntry(the carriertype DG-3.a introduced in PR #4826). Keeps
DecrementGuardand themod-level
SlotHandleon their existingArc<SlotBarrier>fieldtypes so the structural race fix lands as an isolated, bisectable
DG-3.c change.
Sequenced per
docs/design/dg-2b-migration-order.mdstep DG-3.b.Bridge layer (intentional)
SlotBarrieris reshaped into a thin transitional adapter that wrapsshared
Arc<SlotData>+Arc<BarrierState>handles cloned from aSlotEntry.slot_formints a freshArc<SlotBarrier>adapter percall via
SlotBarrier::from_entry; every adapter for the same fileshares the same underlying counter, Condvar, and per-file mutex, so
the FFB-1 in-flight bookkeeping and FFB-2 barrier semantics are
unchanged.
The adapter exists only so
DecrementGuard.barrier: Arc<SlotBarrier>and
SlotHandle.barrier: Arc<SlotBarrier>keep their field typesintact this PR. DG-3.c retypes those fields to the inner Arcs
directly and deletes the adapter.
Call-site retargets
register_file: buildsSlotEntry::new(...)(no outerArc::new).slot_for: clones the entry, builds the adapter Arc, returnsSlotHandle::new(barrier)with the existing signature.flush_workers: clonesentry.barrier(Arc<BarrierState>) andcalls
wait_until_idleon it directly.finish_file: retargets the spin-then-yield loop andArc::try_unwrapontoentry.data(Arc<SlotData>); the spin loopbody is preserved verbatim per the DG-2.b plan.
entry.barrierisdropped explicitly before the spin so only
DecrementGuardcloneskeep the bookkeeping Arc alive.
flush_workers_survives_spurious_wakeuptest: snapshotsentry.barrierinstead of the previous combined Arc; the manualnotify_all()call now resolves toBarrierState::notify.Tests
The
concurrent_register_and_dispatch_on_overlapping_filesstresstest (PR #4667's SSC-1 regression guard) and every other
parallel_apply::tests::*case exercise the public surface only andare unaffected by the bridge. The
flush_workers_survives_spurious_wakeuptest was updated to use the new entry-access path.
Linked work
BarrierState,SlotData,SlotEntry,post-split
SlotHandlealongsideSlotBarrier.DecrementGuard.barrierandSlotHandletohold
Arc<BarrierState>/Arc<SlotData>directly; delete thetransitional adapter. This is the structural race fix step.
finish_filespin loop once DG-3.e confirms therace window is closed.
Test plan
parallel_apply::tests::*andparallel_apply_concurrent::*