Skip to content

docs(design): parallel-flist deterministic delete (#2251) - #4257

Merged
oferchen merged 1 commit into
masterfrom
docs/parallel-deterministic-delete-2251
May 17, 2026
Merged

oferchen merged 1 commit into
masterfrom
docs/parallel-deterministic-delete-2251

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

What the doc establishes

  • Phase 1 / Phase 2 split with the eight invariants the implementation tasks must preserve.
  • f_name_cmp semantics cited to flist.c:3217-3343; reuses our existing compare_file_entries port (crates/protocol/src/flist/sort.rs:60).
  • DeletePlan, DeletePlanMap (DashMap of OnceLock), and DirTraversalCursor type sketches.
  • Per-timing-mode wiring for --delete-before, --delete-during, --delete-after, --delete-delay, --delete-excluded, each cited to its upstream call site.
  • Hardlink coordination (deliberately does NOT consult the hardlink table for destination-side deletion, matching flist_find_ignore_dirness).
  • Error policy mirroring generator.c:291-298 (IOERR_GENERAL skip) and --max-delete exhaustion.
  • Full removal plan for the strict-order flag cluster (94 references across cli / core / engine) and the batched sweep.
  • Test plan: interop event-order parity per timing mode, determinism property tests across rayon worker counts, filter snapshot tests, hardlink + max-delete tests, perf benches.
  • Five-step implementation order keyed to feat: Phase 1 - Comprehensive Parity Gap Analysis #2252-chore: update Homebrew formula for v0.5.1 #2285.

Test plan

Establishes the two-phase model (parallel compute_extras, single
emitter drain) that replaces the batched --delete-during sweep and the
opt-in --delete-strict-order gate from PR #4245. Locks down the
invariants the implementation tasks (#2252-#2285) must preserve:
upstream f_name_cmp ordering per directory, depth-first directory
order, single-emitter side effects, per-directory filter snapshot,
pure workers. Covers all timing modes, hardlink coordination, error
policy, removal plan for the strict-order flag and batched sweep, plus
the interop, determinism, and perf test plan.
@oferchen
oferchen merged commit fd59dfa into master May 17, 2026
8 checks passed
@oferchen
oferchen deleted the docs/parallel-deterministic-delete-2251 branch May 17, 2026 20:14
oferchen added a commit that referenced this pull request May 17, 2026
…lel deterministic delete (#2253, #2254) (#4259)

* feat(engine): DeletePlan, DeletePlanMap, DirTraversalCursor (#2253, #2254)

Adds the data-structure foundation for the parallel-deterministic-delete
pipeline described in docs/design/parallel-deterministic-delete.md
(PR #4257). Three new modules under crates/engine/src/delete/:

- plan.rs: DeletePlan (sorted, frozen per-directory work item),
  DeleteEntry, DeleteEntryKind (mirrors DeleteStats buckets), and a
  HardlinkCohortId newtype. sort_by_name() uses upstream's f_name_cmp
  (PR #4256) ascending then reverses, matching delete_in_dir's loop
  at generator.c:320.
- plan_map.rs: DeletePlanMap, the publish-once concurrent rendezvous
  between phase-1 workers and the phase-2 emitter. Backed by
  Mutex<HashMap> for now; bench-driven choice between Mutex,
  DashMap, and a sharded map is deferred to task DDP-B4 (see code
  comment).
- traversal.rs: DirTraversalCursor, yields directories in upstream's
  depth-first f_name_cmp-ascending order. Tree built from observed
  flist segments via observe_segment(); next_ready() returns the
  next directory whose parent has been emitted.

Pure data structures, no callers; phase-1 and phase-2 wiring lands in
later tasks (#2255-#2278). Unit tests cover plan ordering, concurrent
inserts and takes from 16 threads, out-of-order segment observation,
non-directory filtering, duplicate observations, and high-byte
basename ordering on Unix.

* fix(engine): avoid borrow-checker conflict in DirTraversalCursor::next_ready

Splits the frame inspection from the mutation so the mutable borrow of
the top frame is released before pushing a new frame or popping the
old one. Functionally equivalent.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 17, 2026
oferchen added a commit that referenced this pull request May 18, 2026
Establishes the two-phase model (parallel compute_extras, single
emitter drain) that replaces the batched --delete-during sweep and the
opt-in --delete-strict-order gate from PR #4245. Locks down the
invariants the implementation tasks (#2252-#2285) must preserve:
upstream f_name_cmp ordering per directory, depth-first directory
order, single-emitter side effects, per-directory filter snapshot,
pure workers. Covers all timing modes, hardlink coordination, error
policy, removal plan for the strict-order flag and batched sweep, plus
the interop, determinism, and perf test plan.
oferchen added a commit that referenced this pull request May 18, 2026
…lel deterministic delete (#2253, #2254) (#4259)

* feat(engine): DeletePlan, DeletePlanMap, DirTraversalCursor (#2253, #2254)

Adds the data-structure foundation for the parallel-deterministic-delete
pipeline described in docs/design/parallel-deterministic-delete.md
(PR #4257). Three new modules under crates/engine/src/delete/:

- plan.rs: DeletePlan (sorted, frozen per-directory work item),
  DeleteEntry, DeleteEntryKind (mirrors DeleteStats buckets), and a
  HardlinkCohortId newtype. sort_by_name() uses upstream's f_name_cmp
  (PR #4256) ascending then reverses, matching delete_in_dir's loop
  at generator.c:320.
- plan_map.rs: DeletePlanMap, the publish-once concurrent rendezvous
  between phase-1 workers and the phase-2 emitter. Backed by
  Mutex<HashMap> for now; bench-driven choice between Mutex,
  DashMap, and a sharded map is deferred to task DDP-B4 (see code
  comment).
- traversal.rs: DirTraversalCursor, yields directories in upstream's
  depth-first f_name_cmp-ascending order. Tree built from observed
  flist segments via observe_segment(); next_ready() returns the
  next directory whose parent has been emitted.

Pure data structures, no callers; phase-1 and phase-2 wiring lands in
later tasks (#2255-#2278). Unit tests cover plan ordering, concurrent
inserts and takes from 16 threads, out-of-order segment observation,
non-directory filtering, duplicate observations, and high-byte
basename ordering on Unix.

* fix(engine): avoid borrow-checker conflict in DirTraversalCursor::next_ready

Splits the frame inspection from the mutation so the mutable borrow of
the top frame is released before pushing a new frame or popping the
old one. Functionally equivalent.
oferchen added a commit that referenced this pull request May 18, 2026
Establishes the two-phase model (parallel compute_extras, single
emitter drain) that replaces the batched --delete-during sweep and the
opt-in --delete-strict-order gate from PR #4245. Locks down the
invariants the implementation tasks (#2252-#2285) must preserve:
upstream f_name_cmp ordering per directory, depth-first directory
order, single-emitter side effects, per-directory filter snapshot,
pure workers. Covers all timing modes, hardlink coordination, error
policy, removal plan for the strict-order flag and batched sweep, plus
the interop, determinism, and perf test plan.
oferchen added a commit that referenced this pull request May 18, 2026
…lel deterministic delete (#2253, #2254) (#4259)

* feat(engine): DeletePlan, DeletePlanMap, DirTraversalCursor (#2253, #2254)

Adds the data-structure foundation for the parallel-deterministic-delete
pipeline described in docs/design/parallel-deterministic-delete.md
(PR #4257). Three new modules under crates/engine/src/delete/:

- plan.rs: DeletePlan (sorted, frozen per-directory work item),
  DeleteEntry, DeleteEntryKind (mirrors DeleteStats buckets), and a
  HardlinkCohortId newtype. sort_by_name() uses upstream's f_name_cmp
  (PR #4256) ascending then reverses, matching delete_in_dir's loop
  at generator.c:320.
- plan_map.rs: DeletePlanMap, the publish-once concurrent rendezvous
  between phase-1 workers and the phase-2 emitter. Backed by
  Mutex<HashMap> for now; bench-driven choice between Mutex,
  DashMap, and a sharded map is deferred to task DDP-B4 (see code
  comment).
- traversal.rs: DirTraversalCursor, yields directories in upstream's
  depth-first f_name_cmp-ascending order. Tree built from observed
  flist segments via observe_segment(); next_ready() returns the
  next directory whose parent has been emitted.

Pure data structures, no callers; phase-1 and phase-2 wiring lands in
later tasks (#2255-#2278). Unit tests cover plan ordering, concurrent
inserts and takes from 16 threads, out-of-order segment observation,
non-directory filtering, duplicate observations, and high-byte
basename ordering on Unix.

* fix(engine): avoid borrow-checker conflict in DirTraversalCursor::next_ready

Splits the frame inspection from the mutation so the mutable borrow of
the top frame is released before pushing a new frame or popping the
old one. Functionally equivalent.
oferchen added a commit that referenced this pull request Aug 24, 2026
Establishes the two-phase model (parallel compute_extras, single
emitter drain) that replaces the batched --delete-during sweep and the
opt-in --delete-strict-order gate from PR #4245. Locks down the
invariants the implementation tasks (#2252-#2285) must preserve:
upstream f_name_cmp ordering per directory, depth-first directory
order, single-emitter side effects, per-directory filter snapshot,
pure workers. Covers all timing modes, hardlink coordination, error
policy, removal plan for the strict-order flag and batched sweep, plus
the interop, determinism, and perf test plan.
oferchen added a commit that referenced this pull request Aug 24, 2026
…lel deterministic delete (#2253, #2254) (#4259)

* feat(engine): DeletePlan, DeletePlanMap, DirTraversalCursor (#2253, #2254)

Adds the data-structure foundation for the parallel-deterministic-delete
pipeline described in docs/design/parallel-deterministic-delete.md
(PR #4257). Three new modules under crates/engine/src/delete/:

- plan.rs: DeletePlan (sorted, frozen per-directory work item),
  DeleteEntry, DeleteEntryKind (mirrors DeleteStats buckets), and a
  HardlinkCohortId newtype. sort_by_name() uses upstream's f_name_cmp
  (PR #4256) ascending then reverses, matching delete_in_dir's loop
  at generator.c:320.
- plan_map.rs: DeletePlanMap, the publish-once concurrent rendezvous
  between phase-1 workers and the phase-2 emitter. Backed by
  Mutex<HashMap> for now; bench-driven choice between Mutex,
  DashMap, and a sharded map is deferred to task DDP-B4 (see code
  comment).
- traversal.rs: DirTraversalCursor, yields directories in upstream's
  depth-first f_name_cmp-ascending order. Tree built from observed
  flist segments via observe_segment(); next_ready() returns the
  next directory whose parent has been emitted.

Pure data structures, no callers; phase-1 and phase-2 wiring lands in
later tasks (#2255-#2278). Unit tests cover plan ordering, concurrent
inserts and takes from 16 threads, out-of-order segment observation,
non-directory filtering, duplicate observations, and high-byte
basename ordering on Unix.

* fix(engine): avoid borrow-checker conflict in DirTraversalCursor::next_ready

Splits the frame inspection from the mutation so the mutable borrow of
the top frame is released before pushing a new frame or popping the
old one. Functionally equivalent.
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