mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
seaweed-block: a snapshot delete re-reads each intent page after adopting it
Publication reads every intent page, adopts it under this run's tag, then publishes. A stalled update from another run of the same delete can land between that read and the adoption and put a deleted page's data reference on the entry. Reading the page again after the adoption, before the transition publishes, refuses that case: once this run's tag is on the entry, no such update passes. No persisted change; a run that hits it stays refused, and a new request id writes new pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8e4dc8bd1a
commit
ffc8d4752e
1 file changed
+11
@@ -172,6 +172,17 @@ func RunDeleteSnapshotWithIntent(ctx context.Context, st ListChainStore, base ui
|
||||
if !found || meta.Volume != h.VolumeID || meta.Session != deleteIntentWriter(base, ref) || meta.Mark != "" {
|
||||
return ErrPrecondition
|
||||
}
|
||||
// Read the page again now that this run owns its tag. A stalled
|
||||
// update from another run of the same delete can land between
|
||||
// the read above and the adoption, putting a deleted page's data
|
||||
// reference on this entry; once this run's tag is on it, no such
|
||||
// update passes. An intent published over a page whose data is
|
||||
// gone could never be consumed.
|
||||
again := c
|
||||
again.Ref = ref
|
||||
if _, err := readListPage(ctx, st, h.VolumeID, again); err != nil {
|
||||
return fmt.Errorf("%w: delete intent page changed during adoption: %v", ErrPrecondition, err)
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return Head{}, false, err
|
||||
|
||||
Reference in new issue
Block a user