fix(replica): persist snapshot's own name in its disk meta file #2014
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.37) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 218 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.322
Real PR Conversation Timeline
1 comments
"Review active on #2014"
general
weight: 0.35
KR-Ravindra
Which issue(s) this PR fixes:
Issue longhorn/longhorn#13728
What this PR does / why we need it:
After taking a snapshot, the persisted
volume-snap-<name>.img.metacarries the previous head's filename in itsNamefield instead of the snapshot's own:createDisk()reuses the old head'sdiskstruct for the new snapshot, updatesUserCreated,CreatedandLabelsbut notName, then persists it. The lateractiveDiskData[...].Name = newSnapNamecorrects the same struct in memory, but only after the file was written. On reloadreadDiskData()takesNamefrom the filename, so only the on-disk file is wrong.Nameis now set with the other fields, beforeencodeToFile(); the redundant later assignment is removed.Nameincidentally recorded which head the snapshot was taken from. That is now kept explicitly in a newSourceHeadfield ondisk, so the creation sequence stays available for reconstructing the chain (shuo-wu's point on the issue, requested in review).createDisk()keeps a copy and restores it in the existing rollback. A failed meta write (ENOSPC, say) leaves the head'sName/UserCreated/Created/Labelsintact.Meta files written by earlier versions are not rewritten; they load as before, with an empty
SourceHead.TestSnapshotDiskMetaNameandTestSnapshotMetaWriteFailureRollbackcover both paths, including the persistedSourceHead.Special notes for your reviewer:
None.
Additional documentation or context
Yes, AI-assisted; reviewed by me.