Skip to content

feat: accumulate NDX_DEL_STATS deletion counts in generator - #2563

Merged
oferchen merged 2 commits into
masterfrom
feat/accumulate-del-stats
Mar 7, 2026
Merged

oferchen merged 2 commits into
masterfrom
feat/accumulate-del-stats

Conversation

@oferchen

@oferchen oferchen commented Mar 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace varint discard loops for NDX_DEL_STATS messages with DeleteStats::read_from() and accumulation
  • Add delete_stats: DeleteStats field to GeneratorContext (runtime) and GeneratorStats (returned)
  • Matches upstream main.c:238-247 read_del_stats() which accumulates counts into global counters
  • Uses saturating_add for each field (files, dirs, symlinks, devices, specials)

Previously, NDX_DEL_STATS messages were read and discarded. Now they are parsed into structured DeleteStats and accumulated, making deletion type breakdowns available to callers.

Test plan

  • cargo check -p transfer passes
  • CI passes (fmt, clippy, nextest, all platforms)

Replace discard loops for NDX_DEL_STATS messages with proper parsing
via DeleteStats::read_from() and accumulation into generator state.
Matches upstream main.c:238-247 read_del_stats() which accumulates
counts into global counters.

- Add delete_stats field to GeneratorContext and GeneratorStats
- Replace varint discard loops with DeleteStats::read_from()
- Accumulate stats with saturating_add (upstream semantics)
- Change handle_goodbye and read_ndx_skipping_del_stats to &mut self
@github-actions github-actions Bot added the enhancement New feature or request label Mar 7, 2026
@oferchen
oferchen merged commit 61bf42f into master Mar 7, 2026
31 checks passed
@oferchen
oferchen deleted the feat/accumulate-del-stats branch March 7, 2026 08:50
oferchen added a commit that referenced this pull request May 1, 2026
* feat: accumulate NDX_DEL_STATS deletion counts in generator

Replace discard loops for NDX_DEL_STATS messages with proper parsing
via DeleteStats::read_from() and accumulation into generator state.
Matches upstream main.c:238-247 read_del_stats() which accumulates
counts into global counters.

- Add delete_stats field to GeneratorContext and GeneratorStats
- Replace varint discard loops with DeleteStats::read_from()
- Accumulate stats with saturating_add (upstream semantics)
- Change handle_goodbye and read_ndx_skipping_del_stats to &mut self

* style: fix rustfmt import ordering and line length in generator
oferchen added a commit that referenced this pull request May 5, 2026
* feat: accumulate NDX_DEL_STATS deletion counts in generator

Replace discard loops for NDX_DEL_STATS messages with proper parsing
via DeleteStats::read_from() and accumulation into generator state.
Matches upstream main.c:238-247 read_del_stats() which accumulates
counts into global counters.

- Add delete_stats field to GeneratorContext and GeneratorStats
- Replace varint discard loops with DeleteStats::read_from()
- Accumulate stats with saturating_add (upstream semantics)
- Change handle_goodbye and read_ndx_skipping_del_stats to &mut self

* style: fix rustfmt import ordering and line length in generator
oferchen added a commit that referenced this pull request May 21, 2026
…SSC-1)

Emit a one-time stderr warning at SSH spawn time when both rsync wire
compression (--compress) and SSH stream compression (-C / -o Compression=yes
on the rsync `-e ssh ...` invocation) are enabled. SSH cannot meaningfully
recompress the already-compressed rsync stream, so doing both wastes CPU
and can occasionally expand the payload.

Detection is conservative: it only inspects the SSH command-line built by
the user via `-e` / `--rsh`. Parsing `~/.ssh/config` is left to SSC-3
(#2563); the documentation companion lives in SSC-2 (#2562).

The emitter uses a process-global `OnceLock<bool>` so subsequent SSH
spawns in the same process do not flood stderr. The detection predicate
is split out into a `should_warn_double_compression` helper so the four
new tests (warns_on_double_compression, no_warning_when_only_rsync_compress,
no_warning_when_only_ssh_compress, no_warning_when_neither_compresses)
can exercise the logic without depending on `OnceLock` state.
oferchen added a commit that referenced this pull request May 21, 2026
…H -C (SSC-1) (#4667)

* feat(core): warn on double-compression when --compress meets SSH -C (SSC-1)

Emit a one-time stderr warning at SSH spawn time when both rsync wire
compression (--compress) and SSH stream compression (-C / -o Compression=yes
on the rsync `-e ssh ...` invocation) are enabled. SSH cannot meaningfully
recompress the already-compressed rsync stream, so doing both wastes CPU
and can occasionally expand the payload.

Detection is conservative: it only inspects the SSH command-line built by
the user via `-e` / `--rsh`. Parsing `~/.ssh/config` is left to SSC-3
(#2563); the documentation companion lives in SSC-2 (#2562).

The emitter uses a process-global `OnceLock<bool>` so subsequent SSH
spawns in the same process do not flood stderr. The detection predicate
is split out into a `should_warn_double_compression` helper so the four
new tests (warns_on_double_compression, no_warning_when_only_rsync_compress,
no_warning_when_only_ssh_compress, no_warning_when_neither_compresses)
can exercise the logic without depending on `OnceLock` state.

* fix(engine): close race in concurrent_register_and_dispatch_on_overlapping_files

Cross-tree fix bundled with SSC-1 because this master-side flaky stress
test has been blocking CI on multiple unrelated PRs (#4663, #4665, #4667).

The race: SMALL_OPS=4000 dispatcher operations spread across WORKERS rayon
workers can complete before the registrar's first `register_file(0, ...)`
returns. When that happens every `apply_chunk_parallel` returns the
typed "unknown" error, `expected` (the success-byte counter) stays 0,
and the sanity assertion `assert!(expected > 0)` at line 264 fires.
The probability is small on Linux but reliably observable on Windows
under the tracing feature build.

Added a separate `registrations_done` AtomicU64 the registrar bumps after
each `register_file` returns. Workers block on `registrations_done >= 1`
via yield_now before starting their dispatch loop. The race against the
registrar for ndx >= 1 is preserved, so the test still stresses the
register-vs-dispatch surface.

Followup candidates: SMALL_NUM/SMALL_OPS retuning, deterministic injection
points - not necessary for the immediate unblock.
oferchen added a commit that referenced this pull request Aug 24, 2026
…H -C (SSC-1) (#4667)

* feat(core): warn on double-compression when --compress meets SSH -C (SSC-1)

Emit a one-time stderr warning at SSH spawn time when both rsync wire
compression (--compress) and SSH stream compression (-C / -o Compression=yes
on the rsync `-e ssh ...` invocation) are enabled. SSH cannot meaningfully
recompress the already-compressed rsync stream, so doing both wastes CPU
and can occasionally expand the payload.

Detection is conservative: it only inspects the SSH command-line built by
the user via `-e` / `--rsh`. Parsing `~/.ssh/config` is left to SSC-3
(#2563); the documentation companion lives in SSC-2 (#2562).

The emitter uses a process-global `OnceLock<bool>` so subsequent SSH
spawns in the same process do not flood stderr. The detection predicate
is split out into a `should_warn_double_compression` helper so the four
new tests (warns_on_double_compression, no_warning_when_only_rsync_compress,
no_warning_when_only_ssh_compress, no_warning_when_neither_compresses)
can exercise the logic without depending on `OnceLock` state.

* fix(engine): close race in concurrent_register_and_dispatch_on_overlapping_files

Cross-tree fix bundled with SSC-1 because this master-side flaky stress
test has been blocking CI on multiple unrelated PRs (#4663, #4665, #4667).

The race: SMALL_OPS=4000 dispatcher operations spread across WORKERS rayon
workers can complete before the registrar's first `register_file(0, ...)`
returns. When that happens every `apply_chunk_parallel` returns the
typed "unknown" error, `expected` (the success-byte counter) stays 0,
and the sanity assertion `assert!(expected > 0)` at line 264 fires.
The probability is small on Linux but reliably observable on Windows
under the tracing feature build.

Added a separate `registrations_done` AtomicU64 the registrar bumps after
each `register_file` returns. Workers block on `registrations_done >= 1`
via yield_now before starting their dispatch loop. The race against the
registrar for ndx >= 1 is preserved, so the test still stresses the
register-vs-dispatch surface.

Followup candidates: SMALL_NUM/SMALL_OPS retuning, deterministic injection
points - not necessary for the immediate unblock.
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