Remove stale SQLite journal files on restore #8865
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.35) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 176 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.310
Real PR Conversation Timeline
1 comments
"Review active on #8865"
general
weight: 0.35
twz123
Description
k0s restorecopied the SQLite snapshot over the kine database but left the-wal,-shmand-journalfiles of the database it replaced. SQLite pairs those with the restored file on the next open, so kine could fail with "database disk image is malformed".Restore now removes those files for the configured database path before copying the snapshot. Missing files are fine, any other removal error fails the restore and leaves the old database alone. The copy error was also only logged before, so a failed restore reported success. It's returned now.
Fixes #8864
Type of change
How has this been tested?
The new tests in
internal/backuprestore a realVACUUM INTOsnapshot over a database with stale companion files and check they're gone,PRAGMA integrity_checkis ok and the data matches the backup. They also cover a restore without companion files and a cleanup failure. I only vetted it locally for linux, the tests themselves run in CI.Checklist