Skip to content

Optimize sparse zero detection - #1932

Merged
oferchen merged 1 commit into
masterfrom
implement-rsync-functionality-enhancements
Nov 4, 2025
Merged

oferchen merged 1 commit into
masterfrom
implement-rsync-functionality-enhancements

Conversation

@oferchen

@oferchen oferchen commented Nov 4, 2025 •

Copy link
Copy Markdown
Owner

Summary

  • speed up sparse writer zero-run detection by scanning 16-byte chunks with u128 comparisons
  • add unit coverage to keep the optimized zero detector aligned with the scalar reference
  • document the new sparse fast path expectations in internal docs

Testing

  • cargo test -p rsync-engine zero_run_length

@oferchen
oferchen merged commit f1474cd into master Nov 4, 2025
@oferchen
oferchen deleted the implement-rsync-functionality-enhancements branch November 4, 2025 07:50
oferchen added a commit that referenced this pull request May 1, 2026
Add CompletionPump: a shared completion-port driver that owns a worker
thread looping on GetQueuedCompletionStatusEx and dispatches each
completion entry to a per-operation handler keyed by the OVERLAPPED
pointer. This is the Windows analogue of an io_uring CQE drain and is
the foundational building block for the upcoming batched-write API
(#1898), the concurrent file/socket paths (#1928-#1932), and the IOCP
benchmark harness (#1899).

Existing IocpReader/IocpWriter create a private port and inline-call
GetQueuedCompletionStatus per operation, so the pump introduces a
process-wide proactor without disturbing those single-op paths.

Cross-platform: real implementation lives behind
#[cfg(all(target_os = "windows", feature = "iocp"))]; non-Windows
targets get an Unsupported-returning stub so the crate still compiles
on Linux and macOS.

All unsafe stays inside fast_io per the workspace unsafe-code policy.
oferchen added a commit that referenced this pull request May 5, 2026
Add CompletionPump: a shared completion-port driver that owns a worker
thread looping on GetQueuedCompletionStatusEx and dispatches each
completion entry to a per-operation handler keyed by the OVERLAPPED
pointer. This is the Windows analogue of an io_uring CQE drain and is
the foundational building block for the upcoming batched-write API
(#1898), the concurrent file/socket paths (#1928-#1932), and the IOCP
benchmark harness (#1899).

Existing IocpReader/IocpWriter create a private port and inline-call
GetQueuedCompletionStatus per operation, so the pump introduces a
process-wide proactor without disturbing those single-op paths.

Cross-platform: real implementation lives behind
#[cfg(all(target_os = "windows", feature = "iocp"))]; non-Windows
targets get an Unsupported-returning stub so the crate still compiles
on Linux and macOS.

All unsafe stays inside fast_io per the workspace unsafe-code policy.
oferchen added a commit that referenced this pull request May 7, 2026
Document the Windows ERROR_DISK_FULL test plan for the IOCP
disk-commit path: VHD-backed limited-capacity volume, fatal error
categorisation, completion-port drain on failure, and exit-code
mapping to RERR_FILEIO. Mirrors the Linux ENOSPC coverage filed
under #1148.
oferchen added a commit that referenced this pull request May 17, 2026
Add deterministic disk-full coverage for the Windows IOCP disk-commit
path. Real ERROR_DISK_FULL coverage on CI would require provisioning a
fixed-size VHD or quota-bounded volume per test; both are heavyweight
and flaky on hosted runners. Instead, surface a single-shot fault hook
inside `IocpDiskBatch::submit_one_write` that returns a synthetic Win32
error code before any kernel call.

The hook is dormant by default (a relaxed AtomicUsize load on the
submit path) and exposed as `#[doc(hidden)]` so production callers
never see it. The new integration test
`crates/fast_io/tests/iocp_disk_full_simulation.rs` is cfg-gated to
`windows + iocp`, so it compiles to nothing on Linux and macOS.

Cases covered:
- std maps Win32 ERROR_DISK_FULL (112) and ERROR_HANDLE_DISK_FULL (39)
  onto io::ErrorKind::StorageFull on Rust 1.88.
- First-submission fault during flush surfaces as StorageFull with the
  raw OS error intact, matching what the disk-commit thread reaps from
  a real WriteFile completion.
- commit_file fault leaves a prior successfully-committed file on disk
  intact and lets Drop run cleanly with no panic and no port wedge.
- Hook is single-shot: a second batch after the fault writes through
  end-to-end with no manual reset.
- Nth-submission countdown lets the first two 4 KB chunks reach disk
  before faulting the third, so the file lands at exactly 8 KB.
oferchen added a commit that referenced this pull request May 18, 2026
Document the Windows ERROR_DISK_FULL test plan for the IOCP
disk-commit path: VHD-backed limited-capacity volume, fatal error
categorisation, completion-port drain on failure, and exit-code
mapping to RERR_FILEIO. Mirrors the Linux ENOSPC coverage filed
under #1148.
oferchen added a commit that referenced this pull request May 18, 2026
Add deterministic disk-full coverage for the Windows IOCP disk-commit
path. Real ERROR_DISK_FULL coverage on CI would require provisioning a
fixed-size VHD or quota-bounded volume per test; both are heavyweight
and flaky on hosted runners. Instead, surface a single-shot fault hook
inside `IocpDiskBatch::submit_one_write` that returns a synthetic Win32
error code before any kernel call.

The hook is dormant by default (a relaxed AtomicUsize load on the
submit path) and exposed as `#[doc(hidden)]` so production callers
never see it. The new integration test
`crates/fast_io/tests/iocp_disk_full_simulation.rs` is cfg-gated to
`windows + iocp`, so it compiles to nothing on Linux and macOS.

Cases covered:
- std maps Win32 ERROR_DISK_FULL (112) and ERROR_HANDLE_DISK_FULL (39)
  onto io::ErrorKind::StorageFull on Rust 1.88.
- First-submission fault during flush surfaces as StorageFull with the
  raw OS error intact, matching what the disk-commit thread reaps from
  a real WriteFile completion.
- commit_file fault leaves a prior successfully-committed file on disk
  intact and lets Drop run cleanly with no panic and no port wedge.
- Hook is single-shot: a second batch after the fault writes through
  end-to-end with no manual reset.
- Nth-submission countdown lets the first two 4 KB chunks reach disk
  before faulting the third, so the file lands at exactly 8 KB.
oferchen added a commit that referenced this pull request May 18, 2026
Add deterministic disk-full coverage for the Windows IOCP disk-commit
path. Real ERROR_DISK_FULL coverage on CI would require provisioning a
fixed-size VHD or quota-bounded volume per test; both are heavyweight
and flaky on hosted runners. Instead, surface a single-shot fault hook
inside `IocpDiskBatch::submit_one_write` that returns a synthetic Win32
error code before any kernel call.

The hook is dormant by default (a relaxed AtomicUsize load on the
submit path) and exposed as `#[doc(hidden)]` so production callers
never see it. The new integration test
`crates/fast_io/tests/iocp_disk_full_simulation.rs` is cfg-gated to
`windows + iocp`, so it compiles to nothing on Linux and macOS.

Cases covered:
- std maps Win32 ERROR_DISK_FULL (112) and ERROR_HANDLE_DISK_FULL (39)
  onto io::ErrorKind::StorageFull on Rust 1.88.
- First-submission fault during flush surfaces as StorageFull with the
  raw OS error intact, matching what the disk-commit thread reaps from
  a real WriteFile completion.
- commit_file fault leaves a prior successfully-committed file on disk
  intact and lets Drop run cleanly with no panic and no port wedge.
- Hook is single-shot: a second batch after the fault writes through
  end-to-end with no manual reset.
- Nth-submission countdown lets the first two 4 KB chunks reach disk
  before faulting the third, so the file lands at exactly 8 KB.
oferchen added a commit that referenced this pull request Aug 24, 2026
Document the Windows ERROR_DISK_FULL test plan for the IOCP
disk-commit path: VHD-backed limited-capacity volume, fatal error
categorisation, completion-port drain on failure, and exit-code
mapping to RERR_FILEIO. Mirrors the Linux ENOSPC coverage filed
under #1148.
oferchen added a commit that referenced this pull request Aug 24, 2026
Add deterministic disk-full coverage for the Windows IOCP disk-commit
path. Real ERROR_DISK_FULL coverage on CI would require provisioning a
fixed-size VHD or quota-bounded volume per test; both are heavyweight
and flaky on hosted runners. Instead, surface a single-shot fault hook
inside `IocpDiskBatch::submit_one_write` that returns a synthetic Win32
error code before any kernel call.

The hook is dormant by default (a relaxed AtomicUsize load on the
submit path) and exposed as `#[doc(hidden)]` so production callers
never see it. The new integration test
`crates/fast_io/tests/iocp_disk_full_simulation.rs` is cfg-gated to
`windows + iocp`, so it compiles to nothing on Linux and macOS.

Cases covered:
- std maps Win32 ERROR_DISK_FULL (112) and ERROR_HANDLE_DISK_FULL (39)
  onto io::ErrorKind::StorageFull on Rust 1.88.
- First-submission fault during flush surfaces as StorageFull with the
  raw OS error intact, matching what the disk-commit thread reaps from
  a real WriteFile completion.
- commit_file fault leaves a prior successfully-committed file on disk
  intact and lets Drop run cleanly with no panic and no port wedge.
- Hook is single-shot: a second batch after the fault writes through
  end-to-end with no manual reset.
- Nth-submission countdown lets the first two 4 KB chunks reach disk
  before faulting the third, so the file lands at exactly 8 KB.
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