Skip to content

test(fast_io): IOCP partial-write integration under memory pressure (#1931) - #4234

Merged
oferchen merged 2 commits into
masterfrom
test/iocp-partial-write-1931
May 17, 2026
Merged

oferchen merged 2 commits into
masterfrom
test/iocp-partial-write-1931

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Adds a Windows-only integration test (crates/fast_io/tests/iocp_partial_write_integration.rs) that drives IocpDiskBatch and IocpWriter with a small buffer_size and shallow concurrent_ops so multi-megabyte payloads are issued as many overlapped submissions with multiple completion-port drain cycles per flush. This models the shape that surfaces partial WriteFile completions on memory-constrained Windows hosts and verifies the writers accumulate every byte across resubmissions.
  • Gated by #![cfg(all(target_os = "windows", feature = "iocp"))] so the file compiles to nothing on Linux and macOS. No changes to Cargo.toml; only existing dev-dependencies (tempfile, windows-sys) are used.

Scenarios covered

  • IocpDiskBatch: 16 MiB payload through a 4 KiB buffer with concurrent_ops = 2, fed in 64 KiB slabs - exercises submit_write_batch resubmission logic and GetQueuedCompletionStatusEx drain cycles.
  • IocpWriter: 16 MiB payload through an 8 KiB buffer with sub-buffer slabs - exercises the implicit flush_buffer path in <IocpWriter as Write>::write.
  • IocpWriter: single write_all of 1_500_001 bytes (non-multiple of buffer size) forced to split across many internal chunks - models "one logical write reports a partial completion split across multiple CQEs".
  • Error path: write_data / commit_file against a batch with no active file returns io::ErrorKind::InvalidInput.
  • Error path: begin_file against a read-only handle propagates the underlying ReOpenFile failure rather than silently succeeding.

Each test short-circuits via is_iocp_available() so the suite stays green on Windows hosts where the probe fails.

Test plan

  • CI: fmt+clippy passes (cargo fmt --all -- --check is clean locally).
  • CI: Windows (stable) nextest run picks up the new integration target and all five test cases pass.
  • CI: Linux musl and macOS still build (cfg-gated file compiles to nothing on those targets).

@github-actions github-actions Bot added the test label May 17, 2026
oferchen added 2 commits May 17, 2026 22:53
…1931)

Adds a Windows-only integration test that drives the IOCP writer and
batched disk writer with a small `buffer_size` and shallow `concurrent_ops`
so multi-megabyte payloads must be issued as many overlapped submissions
with multiple completion-port drain cycles per flush. This models the
shape that surfaces partial completions on memory-constrained Windows
hosts and verifies the writer accumulates every byte across resubmissions.

Covers five scenarios:

- `IocpDiskBatch` 16 MiB payload through 4 KiB buffer with 2-op queue
- `IocpWriter` 16 MiB payload through 8 KiB buffer with implicit flushes
- `IocpWriter` single `write_all` of a non-buffer-multiple length forced
  to split across many internal chunks
- error path: write/commit against a batch with no active file returns
  `InvalidInput`
- error path: `begin_file` against a read-only handle propagates the
  underlying `ReOpenFile` failure rather than silently succeeding

Gated by `#![cfg(all(target_os = "windows", feature = "iocp"))]` so the
file compiles to nothing on Linux and macOS. No new dev-dependencies.
@oferchen
oferchen force-pushed the test/iocp-partial-write-1931 branch from f4b92cd to a7aaa9a Compare May 17, 2026 19:53
@oferchen
oferchen merged commit 28a0916 into master May 17, 2026
13 checks passed
oferchen added a commit that referenced this pull request May 18, 2026
…1931) (#4234)

* test(fast_io): IOCP partial-write integration under memory pressure (#1931)

Adds a Windows-only integration test that drives the IOCP writer and
batched disk writer with a small `buffer_size` and shallow `concurrent_ops`
so multi-megabyte payloads must be issued as many overlapped submissions
with multiple completion-port drain cycles per flush. This models the
shape that surfaces partial completions on memory-constrained Windows
hosts and verifies the writer accumulates every byte across resubmissions.

Covers five scenarios:

- `IocpDiskBatch` 16 MiB payload through 4 KiB buffer with 2-op queue
- `IocpWriter` 16 MiB payload through 8 KiB buffer with implicit flushes
- `IocpWriter` single `write_all` of a non-buffer-multiple length forced
  to split across many internal chunks
- error path: write/commit against a batch with no active file returns
  `InvalidInput`
- error path: `begin_file` against a read-only handle propagates the
  underlying `ReOpenFile` failure rather than silently succeeding

Gated by `#![cfg(all(target_os = "windows", feature = "iocp"))]` so the
file compiles to nothing on Linux and macOS. No new dev-dependencies.

* test(fast_io): import FileWriter trait for bytes_written
oferchen added a commit that referenced this pull request May 18, 2026
…1931) (#4234)

* test(fast_io): IOCP partial-write integration under memory pressure (#1931)

Adds a Windows-only integration test that drives the IOCP writer and
batched disk writer with a small `buffer_size` and shallow `concurrent_ops`
so multi-megabyte payloads must be issued as many overlapped submissions
with multiple completion-port drain cycles per flush. This models the
shape that surfaces partial completions on memory-constrained Windows
hosts and verifies the writer accumulates every byte across resubmissions.

Covers five scenarios:

- `IocpDiskBatch` 16 MiB payload through 4 KiB buffer with 2-op queue
- `IocpWriter` 16 MiB payload through 8 KiB buffer with implicit flushes
- `IocpWriter` single `write_all` of a non-buffer-multiple length forced
  to split across many internal chunks
- error path: write/commit against a batch with no active file returns
  `InvalidInput`
- error path: `begin_file` against a read-only handle propagates the
  underlying `ReOpenFile` failure rather than silently succeeding

Gated by `#![cfg(all(target_os = "windows", feature = "iocp"))]` so the
file compiles to nothing on Linux and macOS. No new dev-dependencies.

* test(fast_io): import FileWriter trait for bytes_written
@oferchen
oferchen deleted the test/iocp-partial-write-1931 branch May 19, 2026 19:27
oferchen added a commit that referenced this pull request Aug 24, 2026
…1931) (#4234)

* test(fast_io): IOCP partial-write integration under memory pressure (#1931)

Adds a Windows-only integration test that drives the IOCP writer and
batched disk writer with a small `buffer_size` and shallow `concurrent_ops`
so multi-megabyte payloads must be issued as many overlapped submissions
with multiple completion-port drain cycles per flush. This models the
shape that surfaces partial completions on memory-constrained Windows
hosts and verifies the writer accumulates every byte across resubmissions.

Covers five scenarios:

- `IocpDiskBatch` 16 MiB payload through 4 KiB buffer with 2-op queue
- `IocpWriter` 16 MiB payload through 8 KiB buffer with implicit flushes
- `IocpWriter` single `write_all` of a non-buffer-multiple length forced
  to split across many internal chunks
- error path: write/commit against a batch with no active file returns
  `InvalidInput`
- error path: `begin_file` against a read-only handle propagates the
  underlying `ReOpenFile` failure rather than silently succeeding

Gated by `#![cfg(all(target_os = "windows", feature = "iocp"))]` so the
file compiles to nothing on Linux and macOS. No new dev-dependencies.

* test(fast_io): import FileWriter trait for bytes_written
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