Skip to content

docs(engine): spec Option B SlotBarrier split (DG-2.a) - #4748

Merged
oferchen merged 1 commit into
masterfrom
docs/dg-2a-option-b-spec
May 22, 2026
Merged

oferchen merged 1 commit into
masterfrom
docs/dg-2a-option-b-spec

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Turns the DG-1 audit recommendation (PR #4744,
docs/design/decrementguard-audit.md section 7) into an
implementable spec for DG-3. Adds
docs/design/dg-2a-option-b-spec.md covering:

  • Type split: BarrierState (counter + Condvar) and SlotData
    (per-file payload behind its own mutex), packed in a SlotEntry
    pair carrier that becomes the new DashMap value.
  • Arc ownership invariant: finish_file's try_unwrap target
    (Arc<SlotData>) is structurally disjoint from the Arc the
    worker's DecrementGuard drop body holds (Arc<BarrierState>),
    so the wake-before-Arc-drop window from audit s.4 disappears.
  • Notify path, try_unwrap site, and worker drop-body sequence
    walked race-free step-by-step.
  • Migration order (DG-2.b input) for the eight audited sites: 7
    Arc<SlotBarrier> clones + 1 DecrementGuard construction.
  • Recommendation (DG-2.c input): atomic single-PR migration; no
    shim required because all touched types are crate-private and
    the public ParallelDeltaApplier surface is unchanged.
  • Disappearance of the spin-then-yield workaround at
    crates/engine/src/concurrent_delta/parallel_apply.rs:729-748
    shipped in PR feat(engine): add flush_workers/drain_inflight barrier API to ParallelDeltaApplier (FFB-2) #4665.

This is a pure design spec; no .rs files are touched. DG-3
implements; DG-4 (spin removal) folds into DG-3 once Option B lands;
DG-5 stresses the new shape on Windows.

Test plan

  • DG-3 reads this doc as the single source of truth for the
    split shape and migration order.
  • DG-2.b ratifies the eight-step ordering in section 8.
  • DG-2.c ratifies the atomic-migration recommendation in
    section 7.

Turns the DG-1 audit recommendation into an implementable spec for
DG-3: split SlotBarrier into BarrierState (counter+Condvar) and
SlotData (per-file payload) so finish_file's try_unwrap target is
structurally disjoint from the Arc the worker's DecrementGuard drop
body holds. Recommends atomic single-PR migration, sequences the
eight affected sites, and shows how the spin-then-yield workaround
in parallel_apply.rs:729-748 falls away.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 22, 2026
@oferchen
oferchen merged commit c3d87f8 into master May 22, 2026
10 checks passed
@oferchen
oferchen deleted the docs/dg-2a-option-b-spec branch May 28, 2026 03:37
oferchen added a commit that referenced this pull request Aug 24, 2026
Turns the DG-1 audit recommendation into an implementable spec for
DG-3: split SlotBarrier into BarrierState (counter+Condvar) and
SlotData (per-file payload) so finish_file's try_unwrap target is
structurally disjoint from the Arc the worker's DecrementGuard drop
body holds. Recommends atomic single-PR migration, sequences the
eight affected sites, and shows how the spin-then-yield workaround
in parallel_apply.rs:729-748 falls away.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant