Skip to content

[release-3.6] fix: fsync snap directory when saving a received snapshot db- #22378 - #22401

Merged
fuweid merged 1 commit into
etcd-io:release-3.6from
silentred:v3.6-fsync-snap-dir
Sep 10, 2026
Merged

[release-3.6] fix: fsync snap directory when saving a received snapshot db- #22378#22401
fuweid merged 1 commit into
etcd-io:release-3.6from
silentred:v3.6-fsync-snap-dir

Conversation

@silentred

Copy link
Copy Markdown
Member

backport of #22314

/cc @fuweid @ahrtr @gyuho

@kubernetes-prow
kubernetes-prow Bot requested review from ahrtr and fuweid September 8, 2026 14:19
@kubernetes-prow

Copy link
Copy Markdown

@silentred: GitHub didn't allow me to request PR reviews from the following users: gyuho.

Note that only etcd-io members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

backport of #22314

/cc @fuweid @ahrtr @gyuho

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.70%. Comparing base (c157222) to head (b741e79).

Files with missing lines Patch % Lines
server/etcdserver/api/snap/db.go 86.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
server/etcdserver/api/snap/snapshotter.go 71.91% <100.00%> (+1.57%) ⬆️
server/etcdserver/api/snap/db.go 70.96% <86.66%> (+9.26%) ⬆️

... and 52 files with indirect coverage changes

@@               Coverage Diff               @@
##           release-3.6   #22401      +/-   ##
===============================================
- Coverage        68.83%   67.70%   -1.13%     
===============================================
  Files              420      420              
  Lines            35900    35916      +16     
===============================================
- Hits             24710    24318     -392     
- Misses            9740    10154     +414     
+ Partials          1450     1444       -6     

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c157222...b741e79. Read the comment docs.

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

@gyuho

gyuho commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

lgtm, thanks

@ahrtr

ahrtr commented Sep 9, 2026

Copy link
Copy Markdown
Member

please fix the test flaky (your second commit) in a separate PR, which we also need to cherrypick separately. thx

@silentred

Copy link
Copy Markdown
Member Author

please fix the test flaky (your second commit) in a separate PR, which we also need to cherrypick separately. thx

Yes, that's why I make this PR back to draft.

SaveDBFrom synced a received snapshot database before renaming it into place, but did not sync the containing directory. Linux fsync(2) documents that syncing a file does not necessarily persist its directory entry; the directory must also be synced.

The snapshot receiver calls SaveDBFrom before processing the Raft message, which can later sync the WAL snapshot record. Sync the snapshot directory after rename and on the existing-file retry path, and return sync errors so snapshot handling stops before Raft processing.

Add direct unit coverage that both SaveDBFrom paths invoke directory sync and propagate failures. Keep gofail E2E coverage scoped to failure/retry and crash-before-return control flow; remove tests and claims that did not establish directory-entry durability.

Signed-off-by: Gyuho Lee <gyuhol@nvidia.com>
(cherry picked from commit e9e5656)
Signed-off-by: shenmu.wy <shenmu.wy@antfin.com>
@silentred
silentred marked this pull request as ready for review September 10, 2026 08:47
@silentred silentred closed this Sep 10, 2026
@silentred silentred reopened this Sep 10, 2026
@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahrtr, fuweid, silentred

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fuweid
fuweid merged commit ea74d27 into etcd-io:release-3.6 Sep 10, 2026
30 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants