Skip to content

feat: track deletion counts by file type in receiver - #2568

Merged
oferchen merged 1 commit into
masterfrom
feat/delete-stats-by-type
Mar 7, 2026
Merged

oferchen merged 1 commit into
masterfrom
feat/delete-stats-by-type

Conversation

@oferchen

@oferchen oferchen commented Mar 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace TransferStats.files_deleted: u64 with delete_stats: DeleteStats providing per-type breakdown (files, dirs, symlinks, devices, specials)
  • Classify deleted entries using DirEntry::file_type() in delete_extraneous_files()
  • Parallel path uses par_iter().map().reduce() to merge per-directory stats
  • Unblocks Expose thread-local scratch helper for message rendering #710 (send NDX_DEL_STATS from generator during goodbye phase)

Test plan

  • cargo clippy -p transfer passes
  • 4 delete-related tests pass
  • CI: fmt+clippy, nextest, Windows, macOS, Linux musl

Replace the single `files_deleted: u64` counter in `TransferStats` with
a `delete_stats: DeleteStats` breakdown that separately counts deleted
files, directories, and symlinks. This enables downstream consumers
(NDX_DEL_STATS wire messages, summary output) to report per-type
deletion counts matching upstream rsync's `stats.deleted_files` fields.

The parallel directory scanning path uses `par_iter().map().reduce()`
instead of atomic counters, collecting per-directory `DeleteStats` and
merging them.
@github-actions github-actions Bot added the enhancement New feature or request label Mar 7, 2026
@oferchen
oferchen merged commit 35a2984 into master Mar 7, 2026
32 checks passed
@oferchen
oferchen deleted the feat/delete-stats-by-type branch March 7, 2026 11:13
oferchen added a commit that referenced this pull request May 1, 2026
Replace the single `files_deleted: u64` counter in `TransferStats` with
a `delete_stats: DeleteStats` breakdown that separately counts deleted
files, directories, and symlinks. This enables downstream consumers
(NDX_DEL_STATS wire messages, summary output) to report per-type
deletion counts matching upstream rsync's `stats.deleted_files` fields.

The parallel directory scanning path uses `par_iter().map().reduce()`
instead of atomic counters, collecting per-directory `DeleteStats` and
merging them.
oferchen added a commit that referenced this pull request May 5, 2026
Replace the single `files_deleted: u64` counter in `TransferStats` with
a `delete_stats: DeleteStats` breakdown that separately counts deleted
files, directories, and symlinks. This enables downstream consumers
(NDX_DEL_STATS wire messages, summary output) to report per-type
deletion counts matching upstream rsync's `stats.deleted_files` fields.

The parallel directory scanning path uses `par_iter().map().reduce()`
instead of atomic counters, collecting per-directory `DeleteStats` and
merging them.
oferchen added a commit that referenced this pull request May 21, 2026
…euristic (PIP-3 + PIP-5) (#4666)

* perf(transfer): enable parallel receive-delta by default via Path B heuristic

Wires the receiver-side parallel delta apply path into production per
`docs/design/parallel-receive-delta-default-on.md` Path B, combining
steps 4 and 5 in a single change.

- Add `PARALLEL_RECEIVE_FILE_COUNT_THRESHOLD = 100` and
  `PARALLEL_RECEIVE_BYTES_THRESHOLD = 64 MiB` on the receiver. Thresholds
  match the existing rayon parallel-stat cutoff convention and the
  `copy_file_range` 64 MiB crossover.
- Add `ReceiverContext::select_receiver_strategy(file_count, total_size)`
  (pure heuristic), `total_source_bytes()` (sums the in-memory file
  list), and `dispatch_receiver_strategy()` (logs the decision under the
  `GENR` debug channel and swaps the delta pipeline when the
  `parallel-receive-delta` feature is on).
- Call `dispatch_receiver_strategy` at the top of `run_sync`,
  `run_pipelined`, and `run_pipelined_incremental`, immediately after
  `setup_transfer` returns the file count and the file list is in
  memory.
- Surface the choice as `TransferStats::receiver_strategy_chosen` via
  the new `ReceiverStrategy { Sequential, Parallel }` enum
  (`Sequential` by default).
- Promote `parallel-receive-delta` into the `default = [...]` set on
  `engine`, `transfer`, `core`, `cli`, and the workspace binary so the
  shipped `oc-rsync` picks up the dispatch with no opt-in flag. Stay
  compatible with `--no-default-features` builds: when the feature is
  compiled out the dispatcher logs `receiver_strategy=parallel_unavailable`
  and falls back to sequential so the telemetry counter never lies
  about the path actually taken.

Tests:
- Unit coverage for the heuristic boundary matrix (below/above each
  threshold, exact-boundary, empty transfer).
- File-list-integration coverage for `total_source_bytes` and the full
  `dispatch_receiver_strategy` flow with populated file lists.

Wire-format parity stays guarded by the existing proptests (#4300 +
#4319). The soak + bench gates (criteria 1, 3, 4, 5 in section 5) are
explicit risk acceptance; PIP-4 (interop suite re-run) and PIP-6 (bench
backfill) remain as follow-ups.

Refs #1368, #2566, #2568.

* style(transfer): apply rustfmt to PIP-3+5 receiver-strategy code

CI fmt+clippy diff: collapsed select_receiver_strategy multi-line
signature and the FileEntry::new_file argument list in
dispatch_large_bytes_picks_parallel onto single lines.

Behaviour-neutral.

* fix(transfer): drop identity-op multiplier in receiver-strategy tests

clippy::identity-op fired on `1 * 1024 * 1024`. Collapsed to
`1024 * 1024` in the two boundary-matrix tests.
oferchen added a commit that referenced this pull request Aug 24, 2026
…euristic (PIP-3 + PIP-5) (#4666)

* perf(transfer): enable parallel receive-delta by default via Path B heuristic

Wires the receiver-side parallel delta apply path into production per
`docs/design/parallel-receive-delta-default-on.md` Path B, combining
steps 4 and 5 in a single change.

- Add `PARALLEL_RECEIVE_FILE_COUNT_THRESHOLD = 100` and
  `PARALLEL_RECEIVE_BYTES_THRESHOLD = 64 MiB` on the receiver. Thresholds
  match the existing rayon parallel-stat cutoff convention and the
  `copy_file_range` 64 MiB crossover.
- Add `ReceiverContext::select_receiver_strategy(file_count, total_size)`
  (pure heuristic), `total_source_bytes()` (sums the in-memory file
  list), and `dispatch_receiver_strategy()` (logs the decision under the
  `GENR` debug channel and swaps the delta pipeline when the
  `parallel-receive-delta` feature is on).
- Call `dispatch_receiver_strategy` at the top of `run_sync`,
  `run_pipelined`, and `run_pipelined_incremental`, immediately after
  `setup_transfer` returns the file count and the file list is in
  memory.
- Surface the choice as `TransferStats::receiver_strategy_chosen` via
  the new `ReceiverStrategy { Sequential, Parallel }` enum
  (`Sequential` by default).
- Promote `parallel-receive-delta` into the `default = [...]` set on
  `engine`, `transfer`, `core`, `cli`, and the workspace binary so the
  shipped `oc-rsync` picks up the dispatch with no opt-in flag. Stay
  compatible with `--no-default-features` builds: when the feature is
  compiled out the dispatcher logs `receiver_strategy=parallel_unavailable`
  and falls back to sequential so the telemetry counter never lies
  about the path actually taken.

Tests:
- Unit coverage for the heuristic boundary matrix (below/above each
  threshold, exact-boundary, empty transfer).
- File-list-integration coverage for `total_source_bytes` and the full
  `dispatch_receiver_strategy` flow with populated file lists.

Wire-format parity stays guarded by the existing proptests (#4300 +
#4319). The soak + bench gates (criteria 1, 3, 4, 5 in section 5) are
explicit risk acceptance; PIP-4 (interop suite re-run) and PIP-6 (bench
backfill) remain as follow-ups.

Refs #1368, #2566, #2568.

* style(transfer): apply rustfmt to PIP-3+5 receiver-strategy code

CI fmt+clippy diff: collapsed select_receiver_strategy multi-line
signature and the FileEntry::new_file argument list in
dispatch_large_bytes_picks_parallel onto single lines.

Behaviour-neutral.

* fix(transfer): drop identity-op multiplier in receiver-strategy tests

clippy::identity-op fired on `1 * 1024 * 1024`. Collapsed to
`1024 * 1024` in the two boundary-matrix tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant