mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
fix: refuse name-only snapshot deletes on v1.1 heads
This commit is contained in:
1 parent
ac10680272
commit
c86932e935
12 files changed
+259
-24
No files matched your search
@@ -356,6 +356,7 @@ func layoutCode(err error) string {
|
||||
code string
|
||||
}{
|
||||
{layout.ErrNoSnapshot, "snapshot_not_found"},
|
||||
{layout.ErrSnapshotDeleteNeedsOperation, "snapshot_delete_requires_operation"},
|
||||
{layout.ErrHasDependents, "snapshot_has_dependents"},
|
||||
{layout.ErrForeignSource, "restore_source_not_own"},
|
||||
{layout.ErrHeadAbsent, "volume_not_found"},
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// The old delete succeeded but its reply was lost. The same legacy argv must
|
||||
// not delete a same-name replacement after the HEAD has upgraded to v1.1.
|
||||
func TestSnapshotDeleteLegacyCLIRetryCannotDeleteV11Replacement(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
memory := newMemChunkStore()
|
||||
useMemChunkStore(t, memory)
|
||||
volume := cliVolume(t, memory, "v1", "daily")
|
||||
cat, err := chunkstore.NewBCatalog(memory, memory, defaultChunkPathCLI)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
st, err := cat.Store(volume)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
old, _, err := st.ReadHead(ctx)
|
||||
if err != nil || old.Version != 0 {
|
||||
t.Fatalf("legacy fixture: %+v %v", old, err)
|
||||
}
|
||||
args := cliArgs("snapshot-delete", volArgs("volume", volume), []string{"--name", "daily"})
|
||||
if code, out, _ := runChunk(args...); code != 0 {
|
||||
t.Fatalf("legacy delete failed: %d %s", code, out)
|
||||
}
|
||||
// Discard that reply and recreate the name in a v1.1 HEAD.
|
||||
h, _, err := st.ReadHead(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
replacement := old.Snapshots["daily"]
|
||||
replacement.Gen = h.Gen + 1
|
||||
h.Version = layout.HeadVersion1
|
||||
if h.Snapshots == nil {
|
||||
h.Snapshots = map[string]layout.Snapshot{}
|
||||
}
|
||||
h.Snapshots["daily"] = replacement
|
||||
if err := st.UpdateHead(ctx, h.Gen, h, layout.CauseCommit); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
before, _, err := st.ReadHead(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
code, out, _ := runChunk(args...)
|
||||
var failure chunkErrBody
|
||||
if code != 0 {
|
||||
failure = chunkErrorOut(t, out)
|
||||
}
|
||||
if code != chunkExitFailed || failure.Code != "snapshot_delete_requires_operation" || failure.Retryable {
|
||||
t.Errorf("legacy retry must refuse v1.1: exit=%d body=%s", code, out)
|
||||
}
|
||||
after, _, err := st.ReadHead(ctx)
|
||||
if err != nil || after.Gen != before.Gen || after.Snapshots["daily"].Gen != replacement.Gen {
|
||||
t.Fatalf("lost-reply retry deleted replacement: before=%+v after=%+v err=%v", before, after, err)
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ var kernelRefusals = []struct {
|
||||
{"VolumeDeleting", ErrVolumeDeleting}, {"Detached", ErrDetached}, {"StaleEpoch", ErrStaleEpoch},
|
||||
{"Exists", ErrExists}, {"HasDependents", ErrHasDependents}, {"TargetLive", ErrTargetLive},
|
||||
{"NotPrepared", ErrNotPrepared},
|
||||
{"SnapshotDeleteNeedsOperation", ErrSnapshotDeleteNeedsOperation},
|
||||
{"Identity", ErrIdentity}, {"NoSnapshot", ErrNoSnapshot}, {"Malformed", ErrMalformed},
|
||||
{"HolderActive", ErrHolderActive}, {"NotDeleting", ErrNotDeleting}, {"PositionBehind", ErrPositionBehind},
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrSnapshotDeleteNeedsOperation refuses retry-unsafe name-only deletion on v1.1 HEAD.
|
||||
ErrSnapshotDeleteNeedsOperation = errors.New("layout: v1.1 snapshot deletion requires an operation with a captured name and publishing generation; name-only deletion is unavailable")
|
||||
// ErrNoSnapshot: the named snapshot is not in HEAD.
|
||||
ErrNoSnapshot = errors.New("layout: no such snapshot")
|
||||
// ErrForeignSource: the snapshot names chunks of another volume, so it
|
||||
@@ -79,9 +81,15 @@ func (h Head) AddDependent(name string, target Dependent, root RootName) (next H
|
||||
return next, true, nil
|
||||
}
|
||||
|
||||
// RunDeleteSnapshot applies DeleteSnapshot by one conditional update.
|
||||
// RunDeleteSnapshot is the legacy name-only transition. The version refusal
|
||||
// is checked on the same HEAD generation used by its conditional update.
|
||||
func RunDeleteSnapshot(ctx context.Context, st HeadStore, name string) (Head, error) {
|
||||
return runTransition(ctx, st, CauseSnapshotDelete, func(h Head) (Head, bool, error) { return h.DeleteSnapshot(name) })
|
||||
return runTransition(ctx, st, CauseSnapshotDelete, func(h Head) (Head, bool, error) {
|
||||
if h.Version >= HeadVersion1 {
|
||||
return Head{}, false, ErrSnapshotDeleteNeedsOperation
|
||||
}
|
||||
return h.DeleteSnapshot(name)
|
||||
})
|
||||
}
|
||||
|
||||
// RunAddDependent checks that the named snapshot's root names no chunk of
|
||||
|
||||
@@ -492,7 +492,28 @@ func TestSnapshotOperationBoundReceiptCanBeRebuiltAndRetiredBeforeRemoval(t *tes
|
||||
if _, err := store.ReadSnapshotOperationHandle(ctx, done.ID, done.Verb, done.Instance, done.Sequence); !errors.Is(err, ErrSnapshotOperationRetired) {
|
||||
t.Fatalf("bound terminal did not retire: %v", err)
|
||||
}
|
||||
after, err := layout.RunDeleteSnapshot(ctx, store, "s")
|
||||
current, _, err := store.ReadHead(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
stamped, _, err := current.StampSnapshotGenerations()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := store.UpdateHead(ctx, current.Gen, stamped, layout.CauseCommit); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
current, _, err = store.ReadHead(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
target := layout.SnapshotTarget{Name: "s", Gen: current.Snapshots["s"].Gen}
|
||||
page := layout.ListPage{VolumeID: store.id, Pages: 1, Kind: layout.ListSnapshotDeleteIntent, Producer: "retired-binding-control", Generation: 1, Target: &target, Entries: []string{current.Snapshots["s"].Root.Path()}}
|
||||
ref, err := layout.StageSnapshotDeletePage(ctx, store, current.Gen, page)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
after, err := layout.RunDeleteSnapshotWithIntent(ctx, store, current.Gen, layout.ListCursor{Kind: layout.ListSnapshotDeleteIntent, Producer: page.Producer, Generation: page.Generation, Target: &target, Ref: ref})
|
||||
if err != nil {
|
||||
t.Fatalf("retired settled binding blocked snapshot removal: %v", err)
|
||||
}
|
||||
|
||||
@@ -347,6 +347,8 @@ func chunkErrorCode(err error) (int, string, bool) {
|
||||
case errors.Is(err, durable.ErrDetachOutcomeUnknown):
|
||||
// Before any cause: the detach may still have landed; I/O stays stopped.
|
||||
return http.StatusServiceUnavailable, chunkstore.CodeOutcomeUnknown, true
|
||||
case errors.Is(err, layout.ErrSnapshotDeleteNeedsOperation):
|
||||
return http.StatusConflict, "snapshot_delete_requires_operation", false
|
||||
case errors.Is(err, layout.ErrGeometryMismatch):
|
||||
return http.StatusConflict, chunkstore.CodeGeometryMismatch, false
|
||||
case errors.Is(err, layout.ErrTooManySnapshots):
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
package volume
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSnapshotDeleteLegacyHostRetryCannotDeleteV11Replacement(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
filer := &adapterManifestFiler{Filer: chunkstore.NewMemFiler(), blobs: map[string][]byte{}}
|
||||
cat, err := chunkstore.NewBCatalog(filer, filer, "/chunks")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
id, _ := layout.NewVolumeID()
|
||||
volume := chunkstore.VolumeRef{Name: "v1", ID: id}
|
||||
if _, err := cat.CreateVolume(ctx, volume, layout.Geometry{SizeBytes: 64 * 4096, BlockSize: 4096, ChunkBytes: 4 * 4096}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
st, _ := cat.Store(volume)
|
||||
h, _, err := st.ReadHead(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
original := layout.Snapshot{Root: layout.RootName{Hash: layout.Sum([]byte("original"))}}
|
||||
h.Snapshots = map[string]layout.Snapshot{"daily": original}
|
||||
if err := st.UpdateHead(ctx, h.Gen, h, layout.CauseCommit); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
provider := &fakeChunkProvider{}
|
||||
control := NewChunkControl(provider, cat, volume)
|
||||
if _, err := control.DeleteSnapshot(ctx, "v1", "daily"); err != nil {
|
||||
t.Fatalf("legacy delete: %v", err)
|
||||
}
|
||||
// Discard the reply. The recreated name now belongs to another incarnation.
|
||||
h, _, err = st.ReadHead(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
original.Gen = h.Gen + 1
|
||||
h.Version = layout.HeadVersion1
|
||||
if h.Snapshots == nil {
|
||||
h.Snapshots = map[string]layout.Snapshot{}
|
||||
}
|
||||
h.Snapshots["daily"] = original
|
||||
if err := st.UpdateHead(ctx, h.Gen, h, layout.CauseCommit); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
before, _, err := st.ReadHead(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = control.DeleteSnapshot(ctx, "v1", "daily")
|
||||
status, code, retry := chunkErrorCode(err)
|
||||
if err == nil || status != http.StatusConflict || code != "snapshot_delete_requires_operation" || retry {
|
||||
t.Errorf("legacy retry must refuse v1.1: err=%v status=%d code=%s retry=%v", err, status, code, retry)
|
||||
}
|
||||
after, _, readErr := st.ReadHead(ctx)
|
||||
if readErr != nil || after.Gen != before.Gen || after.Snapshots["daily"].Gen != original.Gen {
|
||||
t.Fatalf("lost-reply retry deleted replacement: before=%+v after=%+v err=%v", before, after, readErr)
|
||||
}
|
||||
if len(provider.kicks) != 1 {
|
||||
t.Fatalf("refused v1.1 delete kicked maintenance: %v", provider.kicks)
|
||||
}
|
||||
}
|
||||
|
||||
// These receipt-outcome controls now remove through the admitted target path.
|
||||
// Their deterministic fixture explicitly stamps legacy entries before admission;
|
||||
// production stamping remains the holder upgrade's responsibility.
|
||||
func removeOperationSnapshotFixture(t *testing.T, ctx context.Context, cat *chunkstore.BCatalog, ref chunkstore.VolumeRef, name string) (layout.Head, error) {
|
||||
t.Helper()
|
||||
st, err := cat.Store(ref)
|
||||
if err != nil {
|
||||
return layout.Head{}, err
|
||||
}
|
||||
h, found, err := st.ReadHead(ctx)
|
||||
if err != nil {
|
||||
return layout.Head{}, err
|
||||
}
|
||||
if !found {
|
||||
return layout.Head{}, layout.ErrHeadAbsent
|
||||
}
|
||||
next, changed, err := h.StampSnapshotGenerations()
|
||||
if err != nil {
|
||||
return layout.Head{}, err
|
||||
}
|
||||
if changed {
|
||||
if err := st.UpdateHead(ctx, h.Gen, next, layout.CauseCommit); err != nil {
|
||||
return layout.Head{}, err
|
||||
}
|
||||
h, _, err = st.ReadHead(ctx)
|
||||
if err != nil {
|
||||
return layout.Head{}, err
|
||||
}
|
||||
}
|
||||
target := h.Snapshots[name].Gen
|
||||
id, err := layout.NewVolumeID()
|
||||
if err != nil {
|
||||
return layout.Head{}, err
|
||||
}
|
||||
op, err := st.AdmitSnapshotDeleteOperation(ctx, id.String(), name, func(context.Context) (uint64, error) { return target, nil })
|
||||
if err != nil {
|
||||
return layout.Head{}, err
|
||||
}
|
||||
done, err := cat.RunSnapshotDeleteOperation(ctx, ref, op, nil)
|
||||
if err != nil {
|
||||
return layout.Head{}, err
|
||||
}
|
||||
if done.State != "succeeded" {
|
||||
return layout.Head{}, fmt.Errorf("delete state %s", done.State)
|
||||
}
|
||||
// This fixture's catalog base is /provider-test. Complete the independent
|
||||
// consumer so subsequent create/replay checks are not stopped by a pending list.
|
||||
reader, err := layout.NewReader("/provider-test", ref.Dir(), st.Fetch)
|
||||
if err != nil {
|
||||
return layout.Head{}, err
|
||||
}
|
||||
return layout.RunConsumeSnapshotDeleteIntent(ctx, st, reader)
|
||||
}
|
||||
@@ -250,7 +250,7 @@ func TestSnapshotOperationAsyncCompletesAndReplaysAfterExecutorRestart(t *testin
|
||||
if err := ctl.closeSnapshotOperations(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := ctl.DeleteSnapshot(ctx, "v1", "daily"); err != nil {
|
||||
if _, err := removeOperationSnapshotFixture(t, ctx, f.Catalog, f.Ref, "daily"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := s.Write(0, bytes.Repeat([]byte{'B'}, 4096)); err != nil {
|
||||
|
||||
@@ -69,7 +69,7 @@ func TestSnapshotOperationAppliedAnswerFailureNeverBecomesRefused(t *testing.T)
|
||||
if err != nil || again.Name != "daily" || !reflect.DeepEqual(before, head()) {
|
||||
t.Fatalf("retry failed original result or republished: %+v %v", again, err)
|
||||
}
|
||||
if _, err := f.Catalog.DeleteSnapshot(ctx, f.Ref, "daily"); err != nil {
|
||||
if _, err := removeOperationSnapshotFixture(t, ctx, f.Catalog, f.Ref, "daily"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
})
|
||||
@@ -100,7 +100,7 @@ func TestSnapshotOperationFailureBeforePublicationRemainsNonterminal(t *testing.
|
||||
}
|
||||
|
||||
func TestSnapshotOperationFencedFailurePreservesPublishedBinding(t *testing.T) {
|
||||
for _, door := range []string{"control", "catalog", "retention"} {
|
||||
for _, door := range []string{"catalog-operation", "retention"} {
|
||||
t.Run(door, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
dp, f, s, head := limitVolume(t)
|
||||
@@ -121,10 +121,8 @@ func TestSnapshotOperationFencedFailurePreservesPublishedBinding(t *testing.T) {
|
||||
}
|
||||
original := chunkstore.SnapshotInfoFromHead("v1", "daily", head())
|
||||
switch door {
|
||||
case "control":
|
||||
_, err = NewChunkControl(dp, f.Catalog, f.Ref).DeleteSnapshot(ctx, "v1", "daily")
|
||||
case "catalog":
|
||||
_, err = f.Catalog.DeleteSnapshot(ctx, f.Ref, "daily")
|
||||
case "catalog-operation":
|
||||
_, err = removeOperationSnapshotFixture(t, ctx, f.Catalog, f.Ref, "daily")
|
||||
case "retention":
|
||||
_, err = layout.RunRetireSnapshot(ctx, st, "daily", original.CreatedNs+1)
|
||||
}
|
||||
@@ -147,9 +145,9 @@ func sameSnapshotOutcome(a, b chunkstore.SnapshotInfo) bool {
|
||||
}
|
||||
|
||||
// The real control -> provider -> LayoutRemote -> conditional filer path must
|
||||
// remember the operation after every existing snapshot-removal door.
|
||||
// remember the operation after captured catalog deletion or policy retirement.
|
||||
func TestSnapshotOperationRetryAfterRemovalKeepsOriginalOutcome(t *testing.T) {
|
||||
for _, door := range []string{"control", "catalog", "retention"} {
|
||||
for _, door := range []string{"catalog-operation", "retention"} {
|
||||
t.Run(door, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
dp, f, s, head := limitVolume(t)
|
||||
@@ -163,10 +161,8 @@ func TestSnapshotOperationRetryAfterRemovalKeepsOriginalOutcome(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
switch door {
|
||||
case "control":
|
||||
_, err = ctl.DeleteSnapshot(ctx, "v1", req.Name)
|
||||
case "catalog":
|
||||
_, err = f.Catalog.DeleteSnapshot(ctx, f.Ref, req.Name)
|
||||
case "catalog-operation":
|
||||
_, err = removeOperationSnapshotFixture(t, ctx, f.Catalog, f.Ref, req.Name)
|
||||
case "retention":
|
||||
st, openErr := f.Catalog.Store(f.Ref)
|
||||
if openErr != nil {
|
||||
@@ -208,7 +204,7 @@ func TestSnapshotOperationOldIDDoesNotAliasReusedName(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err = f.Catalog.DeleteSnapshot(ctx, f.Ref, old.Name); err != nil {
|
||||
if _, err = removeOperationSnapshotFixture(t, ctx, f.Catalog, f.Ref, old.Name); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err = s.Write(0, bytes.Repeat([]byte{'B'}, 4096)); err != nil {
|
||||
@@ -287,7 +283,7 @@ func (f *snapshotLostAnswerFiler) UpdateEntry(ctx context.Context, dir string, e
|
||||
}
|
||||
|
||||
func TestSnapshotOperationLostPublishAnswerReadmitDeleteCannotRepublish(t *testing.T) {
|
||||
testSnapshotLostPublicationRemoval(t, "catalog", true)
|
||||
testSnapshotLostPublicationRemoval(t, "catalog-operation", true)
|
||||
}
|
||||
|
||||
// No successful re-admission may settle the create before removal in this
|
||||
@@ -295,7 +291,7 @@ func TestSnapshotOperationLostPublishAnswerReadmitDeleteCannotRepublish(t *testi
|
||||
// This witnesses the unsettled-publication window, not a persisted stalled
|
||||
// receipt (that control also needs the operation executor).
|
||||
func TestSnapshotOperationRemovalBeforeReadmitKeepsPublishedOutcome(t *testing.T) {
|
||||
for _, door := range []string{"control", "catalog", "retention"} {
|
||||
for _, door := range []string{"catalog-operation", "retention"} {
|
||||
t.Run(door, func(t *testing.T) {
|
||||
testSnapshotLostPublicationRemoval(t, door, false)
|
||||
})
|
||||
@@ -360,10 +356,8 @@ func testSnapshotLostPublicationRemoval(t *testing.T, door string, readmit bool)
|
||||
}
|
||||
}
|
||||
switch door {
|
||||
case "control":
|
||||
_, err = NewChunkControl(dp, cat, f.Ref).DeleteSnapshot(ctx, "v1", req.Name)
|
||||
case "catalog":
|
||||
_, err = cat.DeleteSnapshot(ctx, f.Ref, req.Name)
|
||||
case "catalog-operation":
|
||||
_, err = removeOperationSnapshotFixture(t, ctx, cat, f.Ref, req.Name)
|
||||
case "retention":
|
||||
st, openErr := cat.Store(f.Ref)
|
||||
if openErr != nil {
|
||||
@@ -453,7 +447,7 @@ func TestSnapshotOperationNameConflictRemainsRefusedAfterRemoval(t *testing.T) {
|
||||
t.Fatalf("name conflict code=%s err=%v", code, err)
|
||||
}
|
||||
message := err.Error()
|
||||
if _, err := ctl.DeleteSnapshot(ctx, "v1", "daily"); err != nil {
|
||||
if _, err := removeOperationSnapshotFixture(t, ctx, f.Catalog, f.Ref, "daily"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
before := head()
|
||||
|
||||
@@ -669,6 +669,8 @@ intent consumption needs HEAD/pages, never the receipt; receipt retirement
|
||||
cannot strand it. Lost publication or settlement replies resume the same target.
|
||||
|
||||
|
||||
Name-only snapshot deletion is a legacy-format transition only: it refuses a v1.1 HEAD before publication. Incarnation-qualified deletion uses the admitted target and atomic unlink/intent transition; a retry never resolves a replacement by name.
|
||||
|
||||
## Part B. Invariant ledger
|
||||
|
||||
|
||||
@@ -1342,6 +1344,7 @@ Notes:
|
||||
| `INV-SNAP-OP-FINGERPRINT-001` | A retained operation ID reused with changed snapshot intent refuses before any cut or HEAD write. | M9 operation admission (planned) | `CreateSnapshotOperation` canonical fingerprint; create executor wired; delete executor pending | `TestSnapshotOperationSameIDChangedIntentRefusesBeforeWrite` (`core/host/volume/snapshot_operation_red_test.go`) | SnapOps.Send; rows 211–219 | STUB |
|
||||
| `INV-SNAP-OP-READMIT-001` | A create whose HEAD publication applied before its answer was lost reconciles that original outcome on re-admission; later removal cannot cause another execution under its retained operation ID. | M9 operation re-admission (planned) | `SnapshotOperationBinding`, `LayoutStore.GuardSnapshotOperations`; create executor and compact index wired; native qualification pending | `TestSnapshotOperationLostPublishAnswerReadmitDeleteCannotRepublish`, `TestSnapshotOperationRemovalBeforeReadmitKeepsPublishedOutcome` (`core/host/volume/snapshot_operation_red_test.go`) | SnapOps.Send/Publish/Settle/Delete; rows 211–219 (persisted-stall removal controls included; concurrent-owner controls pending) | STUB |
|
||||
| `INV-SNAP-OP-CLI-001` | Snapshot observation preserves the printed operation ID across retries, polling, interruption and no-wait submission; observing an operation never admits another identity. | M9 operation observation (planned) | `chunkObserveSnapshot`, holder asynchronous create executor | `TestSnapshotOperationCLIUsesPrintedIDForAsyncObservation`, `TestSnapshotOperationCLIInterruptThenResumeUsesPrintedID` (`cmd/sw-block/snapshot_operation_red_test.go`, `cmd/sw-block/snapshot_operation_interrupt_unix_test.go`) | SnapOps.Send/Start; rows 211–219 (server crash controls owed) | STUB |
|
||||
| `INV-SNAP-DELETE-NAME-001` | Name-only snapshot deletion refuses v1.1 HEAD without a HEAD write. A lost-reply retry cannot delete a same-name replacement; a v1.1 delete needs a retained target and its durable intent. | M9 legacy delete admission | `layout.RunDeleteSnapshot`; catalog, CLI and host delete routes | `TestSnapshotDeleteLegacyCLIRetryCannotDeleteV11Replacement`, `TestSnapshotDeleteLegacyHostRetryCannotDeleteV11Replacement` | SnapDelete row 242; rows 241-245 | STUB |
|
||||
| `INV-SNAP-DELETE-LOGICAL-001` | A delete receipt succeeds only after its retained target is proven absent. Actual unlink and its durable reclamation intent publish in one HEAD CAS; physical continuation depends on HEAD/pages, not the receipt. | M9 delete running to succeeded | `snapshotDeleteLogicalStep`, `RunDeleteSnapshotWithIntent` | `TestSnapshotDeleteLogicalCommitKeepsIndependentIntent`, `TestSnapshotDeleteLogicalCommitResumesAcrossLostAnswers`, `TestSnapshotDeleteLogicalCommitSparesReplacement` | SnapDelete rows 241-245; PageChain rows 246-253 | STUB |
|
||||
| `INV-SNAP-DELETE-EXECUTOR-001` | A catalog delete attempt reads its issued handle before work, takes ownership by receipt CAS, and persists uncertain work as stalled. It never infers terminal success from a callback return; terminal replay reads the same incarnation. | M9 delete attempt transport | `BCatalog.RunSnapshotDeleteOperation`; CLI execution seam | `TestSnapshotDeleteCatalogResumesDurableIntentOnAnotherExecutor`, `TestSnapshotDeleteCatalogRefusesWrongIntentBeforeWork`, `TestSnapshotDeleteCatalogCannotInferSuccessFromWorkReturn`, `TestSnapshotDeleteOfflineCLILeavesProgressInFiler` | SnapDelete retained target; SnapOps owner/state refinement; V8 completion adapter and public command activation owed | STUB |
|
||||
| `INV-SNAP-OP-ADMISSION-CLOSE-001` | Admission checks HEAD after receipt publication and refuses a deleting/deleted or absent volume. Closed incarnations cannot answer retained operation queries; their terminal receipt bytes are not rewritten by closing. | M9 admission and observation | `checkSnapshotOperationAdmission`, `readOperationIndex`, create/delete admission | `TestSnapshotOperationAdmissionRechecksHeadAfterPublication`, `TestSnapshotOperationClosedVolumeRefusesReceipts`, `TestSnapshotOperationTerminalReadmissionRechecksHeadAfterFlag` | SnapVolDel rows 257-260 (per-incarnation) | STUB |
|
||||
|
||||
@@ -185,3 +185,14 @@ fabricate success merely by returning nil. Public snapshot-delete flag parsing
|
||||
and admission still need activation against the shared stamped-generation
|
||||
producer. Local controls qualify the logical HEAD/receipt coupling and offline
|
||||
intent resume, not the entire public procedure or native power-loss path.
|
||||
|
||||
## Legacy name-only deletion
|
||||
|
||||
The old `sw-block ops chunk snapshot-delete --name` command and holder
|
||||
snapshot-delete API carry no retained operation identity. They refuse a v1.1
|
||||
HEAD with `snapshot_delete_requires_operation` (not retryable; host HTTP 409).
|
||||
The version check runs inside the common conditional HEAD transition, so a
|
||||
legacy check cannot authorize an update after a concurrent upgrade. This
|
||||
refusal writes no HEAD and does not kick maintenance. Legacy format-0 deletion
|
||||
keeps its previous behavior. Public v1.1 delete admission/flags remain pending;
|
||||
the catalog execution seam requires an already admitted captured target.
|
||||
@@ -475,6 +475,13 @@ sw-block ops chunk snapshots --master MASTER --volume v1 --chunk-filer FIL
|
||||
sw-block ops chunk snapshot-delete --master MASTER --volume v1 --chunk-filer FILER --name s1
|
||||
```
|
||||
|
||||
For a v1.1 HEAD, the name-only `snapshot-delete` command and holder API refuse
|
||||
with `snapshot_delete_requires_operation` (non-retryable). They cannot distinguish
|
||||
a retry of a lost delete reply from deleting a same-name replacement. A v1.1
|
||||
delete requires a retained operation and its captured snapshot identity; public
|
||||
command admission for that path is not enabled yet. The example above applies
|
||||
to legacy v1.0 HEADs.
|
||||
|
||||
`snapshots` answers a JSON array with one entry per published snapshot, in name
|
||||
order: `[{"name":"s1","root":"<64 hex>"}]`. An entry also lists
|
||||
`"dependents":["v2-<id8>"]` while restore targets depend on that snapshot. An
|
||||
|
||||
Reference in new issue
Block a user