platform: use FILE_FLAG_WRITE_THROUGH on Windows for SyncFile data durability, fixes #9388#9389
Open
mr-raj12 wants to merge 1 commit intoborgbackup:masterfrom
Open
platform: use FILE_FLAG_WRITE_THROUGH on Windows for SyncFile data durability, fixes #9388#9389mr-raj12 wants to merge 1 commit intoborgbackup:masterfrom
mr-raj12 wants to merge 1 commit intoborgbackup:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9389 +/- ##
=======================================
Coverage 76.43% 76.43%
=======================================
Files 85 85
Lines 14800 14800
Branches 2212 2212
=======================================
Hits 11313 11313
Misses 2809 2809
Partials 678 678 ☔ View full report in Codecov by Sentry. |
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.
Description
Implement Windows-native
SyncFileusingCreateFileWwithFILE_FLAG_WRITE_THROUGHto bypass volatile write caches and write directly to persistent storage. This is the Windows equivalent of the macOSF_FULLFSYNCfix (#9383 / PR #9385).Fixes #9388
Changes
src/borg/platform/windows.pyx— addSyncFilesubclass usingCreateFileW+FILE_FLAG_WRITE_THROUGH; falls back to base when an existing fd is provided (e.g.SaveFile)src/borg/platform/__init__.py— importSyncFilefrom.windowsinstead of.basesrc/borg/platform/base.py— update resolved TODO commentsrc/borg/testsuite/platform/platform_test.py— addskipif_not_win32markersrc/borg/testsuite/platform/windows_test.py— 6 tests (write/read, FileExistsError, text mode, fd fallback, sync, write-through flag verification)Checklist
master(or maintenance branch if only applicable there)toxor the relevant test subset)