Serialize pipeline book appends across running instances #4891

Open
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/4891 into main
andrewpozdnakov7-jpg commented 2026-12-01 13:04:49 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-12-01T13:04:49Z.


What it changes

The pipeline-book writer opens a file, seeks to the end, and remembers that length for rollback. Two running instances can open the same file and seek to the same offset. The second write can replace records written by the first.

This change lets one Windows handle write the file at a time, from the initial seek through any rollback. Other instances keep their records in the existing retry queue when the file is busy. Readers can still open the book during the write.

How it was tested

  • One Windows Rust fixture ran the exact open_append from main 5fabb46e and 812c0c63ee5cfdb723effc23edd4a8cd36a355ab against a synthetic file with two independent handles. Release e1251c31 has the same open_append as main.
  • Before, both handles recorded offset 5. The second replaced the first new record. After, the overlapping open returned a sharing violation. Once the first writer closed, the retry reopened at offset 11 and both records were present.
  • A reader remained open for the sequence, and the first writer could roll back a partial append before storing its record. cargo xtask policy --staged accepted the source file.
  • Main's CI check has five existing Clippy errors tracked in #4707.

Checked for overlap

  • Searched open and closed issues and PRs for concurrent writers and book appends. #2249 preserves records after write or rollback failures. #4868 concerns the startup reader and tail repair.

Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5586275913 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4891). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-12-01T13:04:49Z. --- ## What it changes The pipeline-book writer opens a file, seeks to the end, and remembers that length for rollback. Two running instances can open the same file and seek to the same offset. The second write can replace records written by the first. This change lets one Windows handle write the file at a time, from the initial seek through any rollback. Other instances keep their records in the existing retry queue when the file is busy. Readers can still open the book during the write. ## How it was tested - One Windows Rust fixture ran the exact `open_append` from main `5fabb46e` and `812c0c63ee5cfdb723effc23edd4a8cd36a355ab` against a synthetic file with two independent handles. Release `e1251c31` has the same `open_append` as main. - Before, both handles recorded offset 5. The second replaced the first new record. After, the overlapping open returned a sharing violation. Once the first writer closed, the retry reopened at offset 11 and both records were present. - A reader remained open for the sequence, and the first writer could roll back a partial append before storing its record. `cargo xtask policy --staged` accepted the source file. - Main's [CI check](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46563306780/job/142355972539) has five existing Clippy errors tracked in #4707. ## Checked for overlap - [x] Searched open and closed issues and PRs for concurrent writers and book appends. #2249 preserves records after write or rollback failures. #4868 concerns the startup reader and tail repair. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change into another commit. AI-assisted with OpenAI Codex.
Dukestar69 commented 2026-12-01 16:23:10 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-12-01T16:23:10Z.

Review: APPROVED


Reviewed crates/victory-gpu/src/pipeline/known.rs: opening the pipeline book with FILE_SHARE_READ via OpenOptionsExt::share_mode serializes concurrent writers from seek through potential set_len rollback while still allowing concurrent readers. Verified on Windows (RTX 5090): cargo test -p victory-gpu --lib pipeline::known::tests -- --test-threads=1 (14 passed, 0 failed).

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6135369983 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4891#pullrequestreview-6135369983). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-12-01T16:23:10Z. **Review:** APPROVED --- Reviewed crates/victory-gpu/src/pipeline/known.rs: opening the pipeline book with FILE_SHARE_READ via OpenOptionsExt::share_mode serializes concurrent writers from seek through potential set_len rollback while still allowing concurrent readers. Verified on Windows (RTX 5090): cargo test -p victory-gpu --lib pipeline::known::tests -- --test-threads=1 (14 passed, 0 failed). Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/4891:upstream-pr/4891'
git switch 'upstream-pr/4891'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/4891'
git switch 'upstream-pr/4891'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/4891'
git switch 'upstream-pr/4891'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/4891'
git switch 'main'
git merge --squash 'upstream-pr/4891'
git switch 'main'
git merge --ff-only 'upstream-pr/4891'
git switch 'main'
git merge 'upstream-pr/4891'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!4891
No description provided.