diff --git a/seaweed-block/core/frontend/chunkstore/catalog.go b/seaweed-block/core/frontend/chunkstore/catalog.go index 9859db5955..d7e1dfa2ba 100644 --- a/seaweed-block/core/frontend/chunkstore/catalog.go +++ b/seaweed-block/core/frontend/chunkstore/catalog.go @@ -856,14 +856,7 @@ func (c *Catalog) CreateSnapshot(ctx context.Context, vol string, req SnapshotRe // Settle this name as the delete does: the attempt's tombstone or // its winning publication is confirmed before the name is freed; // on failure the name stays, so the delete still finds it. - if red := true; red { // RED: the name is freed even when the abort write failed - if tomb, err := c.abortedSnapEntry(vol, req.Name, attempt); err == nil { - _ = c.f.CreateEntry(ctx, path.Join(root, snapsDir, req.Name), tomb, true) - } - _, _, _ = c.freeName(ctx, root, req.Name, attempt) - } else { - _, _, _, _ = c.deleteNameForVolume(ctx, vol, root, req.Name) - } + _, _, _, _ = c.deleteNameForVolume(ctx, vol, root, req.Name) return SnapshotInfo{}, refuseDeleted(vol, "it cannot be snapshotted") } diff --git a/seaweed-block/core/frontend/chunkstore/volume_delete.go b/seaweed-block/core/frontend/chunkstore/volume_delete.go index fd95e4ef06..2a2b13c73a 100644 --- a/seaweed-block/core/frontend/chunkstore/volume_delete.go +++ b/seaweed-block/core/frontend/chunkstore/volume_delete.go @@ -124,7 +124,7 @@ func (c *Catalog) DeleteVolume(ctx context.Context, vol string, admit Admission) // commit an earlier run may have lost). if admit != nil { if err := admit.Admit(ctx, vol); err != nil { - if errors.Is(err, ErrNotAdmitted) || true { // RED: any admission error reads as a refusal + if errors.Is(err, ErrNotAdmitted) { return res, catErr(CodeVolumeInUse, false, err, "volume %s: delete not admitted", vol) } res.AdmissionUncertain, res.Uncertain = true, true @@ -133,9 +133,6 @@ func (c *Catalog) DeleteVolume(ctx context.Context, vol string, admit Admission) } res.Admitted = true giveBack := func(cause error) (VolumeDeleteResult, error) { - if red := true; red { // RED: a give-back leaves the admission in place - return res, cause - } if admit != nil { if err := admit.Abort(ctx, vol); err != nil { res.Uncertain = true @@ -169,7 +166,7 @@ func (c *Catalog) DeleteVolume(ctx context.Context, vol string, admit Admission) case rerr != nil: res.Uncertain = u return res, rerr - case !reverted && false: // RED: a revert that found the HEAD committed still counts as given back + case !reverted: // Another delete committed meanwhile: its irreversible steps // stand; this call neither reverts nor gives back. return res, catErr(CodeOutcomeUnknown, true, nil, "volume %s: another delete committed while this one found %v; rerun the delete", vol, live) diff --git a/seaweed-block/core/host/master/services.go b/seaweed-block/core/host/master/services.go index f6f4787896..8d78fa13aa 100644 --- a/seaweed-block/core/host/master/services.go +++ b/seaweed-block/core/host/master/services.go @@ -60,7 +60,7 @@ func (s *services) CreateVolume(ctx context.Context, req *control.CreateVolumeRe // created again; the reservation is checked under the lock its writer // holds. s.host.workspaceMu.Lock() - reserved := stores.Deletions.Reserved(spec.VolumeID) && false // RED: the reservation does not stop CreateVolume + reserved := stores.Deletions.Reserved(spec.VolumeID) s.host.workspaceMu.Unlock() if reserved { return nil, status.Errorf(codes.FailedPrecondition, "create volume: %s is being deleted or was deleted; its id is never reused", spec.VolumeID) diff --git a/seaweed-block/core/lifecycle/deletion_reservations.go b/seaweed-block/core/lifecycle/deletion_reservations.go index f1f0b462d8..79ebd5cc6a 100644 --- a/seaweed-block/core/lifecycle/deletion_reservations.go +++ b/seaweed-block/core/lifecycle/deletion_reservations.go @@ -189,9 +189,6 @@ func (s *DeletionReservationStore) update(vol string, protective bool, change fu } func (s *DeletionReservationStore) persist(next map[string]DeletionReservation, protective bool) error { - if red := true; red { // RED: intent-only, nothing written or synced - return nil - } b, err := json.Marshal(next) if err != nil { return err