Repository navigation
test(engine): verify finish_file try_unwrap uncontended after DG-3.c (DG-3.d) - #4855
Merged
Merged
Conversation
…(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
force-pushed
the
test/dg-3d-finish-file-uncontended-verify
branch
from
May 24, 2026 11:24
14f8151 to
b0e35b9
Compare
1 of 2 tasks
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
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.d verification task. DG-3.c (#4845) retyped
DecrementGuard.barrierfrom
Arc<SlotBarrier>toArc<BarrierState>per the DG-2.a Option-Bspec (
docs/design/dg-2a-option-b-spec.mdsection 2). This PR pins thestrong-count invariant at the actual
Arc::try_unwrapcall site indrain.rs::finish_fileso a future regression cannot silentlyre-introduce a payload-Arc clone on the worker drop path.
The audit at
docs/audits/dg-3d-finish-file-uncontended.md:Arc<SlotData>.SlotHandle's field-dropordering.
try_unwrapsite 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 serialapply_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
SlotHandleretype is still deferred (SlotHandle.barrierremainsArc<SlotBarrier>adapter); the dead code pathsSlotBarrier::lock_slotandSlotBarrier::increment_inflightshould be retired by the follow-on DG-3.x task. Does not regress
the DG-3.d invariant.
drain.rs::finish_filestill spins onArc::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
engine::concurrent_delta::parallel_apply::tests).invariant is platform-independent).
References
docs/design/dg-2a-option-b-spec.mdsections3-6
docs/audits/dg-3d-finish-file-uncontended.md