Backport release/v6.6: Validate snapshots before publication - #4053
Conversation
|
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin backport-4036-to-release/v6.6
git worktree add --checkout .worktree/backport-4036-to-release/v6.6 backport-4036-to-release/v6.6
cd .worktree/backport-4036-to-release/v6.6
git reset --hard HEAD^
git cherry-pick -x f28da4c23213808d751969e99a2ee3ccf41f8473
git push --force-with-lease |
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/v6.6 #4053 +/- ##
================================================
- Coverage 59.08% 58.53% -0.55%
================================================
Files 2231 2175 -56
Lines 184478 178868 -5610
================================================
- Hits 109001 104704 -4297
+ Misses 65650 64808 -842
+ Partials 9827 9356 -471
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
PR SummaryHigh Risk Overview
Load and write paths are tightened: metadata and mmap layout checks, snapshot open validation, and 32-byte hash checks on snapshot writers wrap corruption as Broad Reviewed by Cursor Bugbot for commit a000cda. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a000cda. Configure here.
| } | ||
| if renameErr := os.Rename(path, targetPath); renameErr != nil { | ||
| return fmt.Errorf("rename snapshot directory to %q: %w", targetPath, renameErr) | ||
| } |
There was a problem hiding this comment.
Unsafe snapshot replacement loses data
High Severity
publishSnapshot removes the existing snapshot directory before the replacement rename finishes. A crash in that window, or a failed second rename, leaves current pointing at a deleted directory. RewriteSnapshot then always runs cleanupFailedSnapshotRewrite on publication errors, which deletes the validated temp — the only remaining copy. On restart, removeTmpDirs also drops leftover -tmp dirs, and createDBIfNotExist now refuses to initialize over a dangling current, so the node cannot recover.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a000cda. Configure here.


Backport of #4036 to
release/v6.6.