Skip to content

fix(store/snapshots): flush chunk files to disk before recording snapshot#25913

Open
songgaoye wants to merge 10 commits intocosmos:mainfrom
songgaoye:fix_snapshots_saveChunk
Open

fix(store/snapshots): flush chunk files to disk before recording snapshot#25913
songgaoye wants to merge 10 commits intocosmos:mainfrom
songgaoye:fix_snapshots_saveChunk

Conversation

@songgaoye
Copy link
Copy Markdown
Contributor

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

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 73.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.80%. Comparing base (3bcf4ec) to head (91ed0a6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
store/snapshots/store.go 73.33% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Files with missing lines Coverage Δ
store/snapshots/store.go 86.63% <73.33%> (+86.63%) ⬆️

... and 33 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants