Skip to content

test(engine): verify finish_file try_unwrap uncontended after DG-3.c (DG-3.d) - #4855

Merged
oferchen merged 2 commits into
masterfrom
test/dg-3d-finish-file-uncontended-verify
May 24, 2026
Merged

oferchen merged 2 commits into
masterfrom
test/dg-3d-finish-file-uncontended-verify

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

DG-3.d verification task. DG-3.c (#4845) retyped DecrementGuard.barrier
from Arc<SlotBarrier> to Arc<BarrierState> per the DG-2.a Option-B
spec (docs/design/dg-2a-option-b-spec.md section 2). This PR pins the
strong-count invariant at the actual Arc::try_unwrap call site in
drain.rs::finish_file so a future regression cannot silently
re-introduce a payload-Arc clone on the worker drop path.

The audit at docs/audits/dg-3d-finish-file-uncontended.md:

  • Identifies the unwrap target as Arc<SlotData>.
  • Enumerates every clone path that touches the payload Arc (6 sites).
  • Traces the worker drop sequence against SlotHandle's field-drop
    ordering.
  • Confirms that after DG-3.c the payload Arc strong count at the
    try_unwrap site is deterministically 1 on every successful path.

Three regression tests cover both runtime (strong counts) and
structural (distinct allocations) gates:

  • finish_file_payload_arc_uncontended_after_worker_drop -
    three-channel handshake pins the post-drop strong count to 1.
  • finish_file_payload_arc_uncontended_under_burst - 32 serial
    apply_one_chunk calls confirm per-iteration return to 1.
  • finish_file_payload_and_barrier_arcs_are_distinct_allocations -
    Arc::as_ptr().addr() witness that the Option-B split is intact.

Residual risk

  • SlotHandle retype is still deferred (SlotHandle.barrier remains
    Arc<SlotBarrier> adapter); the dead code paths
    SlotBarrier::lock_slot and SlotBarrier::increment_inflight
    should be retired by the follow-on DG-3.x task. Does not regress
    the DG-3.d invariant.
  • drain.rs::finish_file still spins on Arc::strong_count > 1.
    After DG-3.d, the spin executes zero iterations on every path the
    regression tests exercise. DG-4 (remove the spin) is now safe
    to land - this PR provides the exact precondition DG-4 needs.

Test plan

  • CI nextest passes (new tests under
    engine::concurrent_delta::parallel_apply::tests).
  • CI fmt+clippy passes.
  • Windows / macOS / Linux musl matrices pass (the strong-count
    invariant is platform-independent).

References

@github-actions github-actions Bot added the test label May 24, 2026
oferchen added 2 commits May 24, 2026 14:24
…(DG-3.d)

Pin the DG-2.a Option-B strong-count invariant at the actual
Arc::try_unwrap call site in drain.rs::finish_file. After DG-3.c
(#4845) retyped DecrementGuard.barrier to Arc<BarrierState>, the
worker's lingering decrement-guard clone lives on a disjoint
allocation from the payload Arc the flusher unwraps.

Three regression tests cover:

- finish_file_payload_arc_uncontended_after_worker_drop:
  deterministic three-channel handshake pins the moment the worker
  has fully retired its SlotHandle; asserts entry.data strong count
  is exactly 1 (DashMap only) and finish_file succeeds.
- finish_file_payload_arc_uncontended_under_burst: 32 serial
  apply_one_chunk calls; asserts the per-iteration post-drop count
  returns to 1.
- finish_file_payload_and_barrier_arcs_are_distinct_allocations:
  structural witness via Arc::as_ptr that the Option-B split is
  intact at the type level.

Audit at docs/audits/dg-3d-finish-file-uncontended.md enumerates
every Arc<SlotData> clone path and the worker drop sequence,
confirming the spin-then-yield workaround in drain.rs is now a
no-op on every successful path and DG-4 (spin removal) is unblocked.
@oferchen
oferchen force-pushed the test/dg-3d-finish-file-uncontended-verify branch from 14f8151 to b0e35b9 Compare May 24, 2026 11:24
@oferchen
oferchen merged commit ce56051 into master May 24, 2026
16 checks passed
@oferchen
oferchen deleted the test/dg-3d-finish-file-uncontended-verify branch May 28, 2026 03:37
oferchen added a commit that referenced this pull request Aug 24, 2026
…(DG-3.d) (#4855)

* test(engine): verify finish_file try_unwrap uncontended after DG-3.c (DG-3.d)

Pin the DG-2.a Option-B strong-count invariant at the actual
Arc::try_unwrap call site in drain.rs::finish_file. After DG-3.c
(#4845) retyped DecrementGuard.barrier to Arc<BarrierState>, the
worker's lingering decrement-guard clone lives on a disjoint
allocation from the payload Arc the flusher unwraps.

Three regression tests cover:

- finish_file_payload_arc_uncontended_after_worker_drop:
  deterministic three-channel handshake pins the moment the worker
  has fully retired its SlotHandle; asserts entry.data strong count
  is exactly 1 (DashMap only) and finish_file succeeds.
- finish_file_payload_arc_uncontended_under_burst: 32 serial
  apply_one_chunk calls; asserts the per-iteration post-drop count
  returns to 1.
- finish_file_payload_and_barrier_arcs_are_distinct_allocations:
  structural witness via Arc::as_ptr that the Option-B split is
  intact at the type level.

Audit at docs/audits/dg-3d-finish-file-uncontended.md enumerates
every Arc<SlotData> clone path and the worker drop sequence,
confirming the spin-then-yield workaround in drain.rs is now a
no-op on every successful path and DG-4 (spin removal) is unblocked.

* style(engine): apply rustfmt to DG-3.d test additions
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