fix(store/snapshots): flush chunk files to disk before recording snapshot#25913
Open
songgaoye wants to merge 10 commits intocosmos:mainfrom
Open
fix(store/snapshots): flush chunk files to disk before recording snapshot#25913songgaoye wants to merge 10 commits intocosmos:mainfrom
songgaoye wants to merge 10 commits intocosmos:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25913 +/- ##
==========================================
+ Coverage 67.45% 69.80% +2.34%
==========================================
Files 935 936 +1
Lines 61869 61916 +47
==========================================
+ Hits 41734 43219 +1485
+ Misses 20135 18697 -1438
🚀 New features to boost your workflow:
|
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
Calling Sync forces the OS to flush the chunk’s data and metadata to disk before we record the snapshot as saved.
Without it, a crash or power loss after Save returns but before the OS flushes buffers could leave us with a metadata entry pointing to a chunk file that never actually reached storage.
This desynchronizes the snapshot store and forces operators to manually clean up or rerun snapshot generation.
By syncing each chunk file, we ensure that once Save succeeds, all chunk contents are durable and the snapshot can survive restarts.
Closes: #XXXX