fix(cache): complete atomic shard writes on Windows - #914
Merged
Conversation
Drop the temporary shard writer before atomic replacement, then reopen the installed shard with read and write access for the final durability sync. This avoids carrying a caller-owned source handle into MoveFileExW and gives FlushFileBuffers the access mode it requires.\n\nAdd a direct shard write/read regression without changing cache format, parser versions, shard identity, retry policy, or TUI behavior. Fixes junhoyeo#913.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #913
Summary
MoveFileExW.FlushFileBuffers.Current-upstream adaptation
write_shard_with_limittemporary envelope writersync_all()OpenOptions::new().read(true).write(true)fs_atomic::replace_filewith #906 retry behaviorThe source behavior was recovered into TokenBar PR #59. The Windows validation ancestry and full downstream evidence are recorded in the handoff comment.
Verification
cargo test -p tokscale-core test_write_shard_round_trips_after_atomic_replace -- --test-threads=1cargo test -p tokscale-core test_save_if_dirty_marks_cache_clean -- --test-threads=1cargo fmt --all -- --checkcargo clippy --locked --workspace --all-features -- -D warningscargo test --workspace --all-featurescargo build --release -p tokscale-cligit diff --checkWindows evidence boundary
The downstream handle-ordering fix was executed and validated on Windows. This PR adapts that invariant to the current shard writer. Upstream
Build Nativechecks Windows x64 and arm64 compilation only; it does not execute this regression on Windows. Unless an additional Windows runner runs the test, this PR does not claim independent upstream Windows runtime verification.Summary by cubic
Fixes atomic shard writes on Windows by closing the temp writer before replacement and reopening the final shard for a proper flush. Prevents handle conflicts and ensures cache durability after writes.
MoveFileExW.sync_all()to satisfy WindowsFlushFileBuffers.Written for commit e15e66b. Summary will update on new commits.