diff --git a/seaweed-block/core/host/master/host.go b/seaweed-block/core/host/master/host.go index 5e46b58a54..e61bb94129 100644 --- a/seaweed-block/core/host/master/host.go +++ b/seaweed-block/core/host/master/host.go @@ -187,6 +187,9 @@ type Host struct { retirementMu sync.Mutex retirementNext map[string]time.Time retirementAfter string + // One startup retry, after the latest lease barrier seen by that sweep. + // This is a scheduling hint; the retry rechecks every retirement guard. + retirementRetryAt time.Time // bindingRetry: volumes whose binding reconcile failed, retried with the // next call's own volume (workspaceMu held). bindingRetry map[string]bool @@ -629,6 +632,7 @@ func (h *Host) Start() context.Context { }() h.obs.Start(ctx) + h.startPostFloorRetirement(ctx) h.wg.Add(1) go func() { diff --git a/seaweed-block/core/host/master/spec_retirement.go b/seaweed-block/core/host/master/spec_retirement.go index 0b44920af7..7ed6ea6010 100644 --- a/seaweed-block/core/host/master/spec_retirement.go +++ b/seaweed-block/core/host/master/spec_retirement.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "sort" + "strings" "time" "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" @@ -70,6 +71,7 @@ func (h *Host) ReconcileDeletedSpecVolumes(ctx context.Context) error { func (h *Host) reconcileDeletedSpecVolumes(ctx context.Context, limited bool, now time.Time) error { stores := h.Lifecycle() if stores == nil || h.cfg.LayoutReadHead == nil { + h.logRetirementSkip(limited, "", "retirement_reader_unavailable", nil) return nil } h.retirementMu.Lock() @@ -103,6 +105,7 @@ func (h *Host) reconcileDeletedSpecVolumes(ctx context.Context, limited bool, no rec := records[(start+i)%len(records)] id := rec.Spec.VolumeID if !stores.Deletions.CommittedSnapshot(id) { + h.logRetirementSkip(limited, id, "not_reserved", nil) continue } proof, terminal := h.noWork.Load(id) @@ -110,12 +113,19 @@ func (h *Host) reconcileDeletedSpecVolumes(ctx context.Context, limited bool, no // Kept records cannot retire; their terminal NoWork proof never // changes under a permanent tombstone, so there is no remote polling. if terminal && (h.specDesired == nil || h.specDesired[id]) { + h.logRetirementSkip(limited, id, "in_spec_terminal", nil) continue } if limited && (attempted || now.Before(h.retirementNext[id])) { continue } if err := h.Publisher().NoLiveWorkspaceLease(ctx, id); err != nil { + h.logRetirementSkip(limited, id, "lease_not_proven_ended", err) + if !limited { + if at, ok := retirementLeaseBarrier(err); ok && at.After(h.retirementRetryAt) { + h.retirementRetryAt = at + } + } continue } attempted = true @@ -123,9 +133,14 @@ func (h *Host) reconcileDeletedSpecVolumes(ctx context.Context, limited bool, no h.retirementNext[id] = now.Add(h.cfg.Freshness.EffectiveFreshnessWindow()) readCtx, cancel := context.WithTimeout(ctx, 5*time.Second) head, readErr := h.cfg.LayoutReadHead(readCtx, rec.Spec) + ended := readCtx.Err() cancel() + if ended != nil { + h.logRetirementSkip(limited, id, "head_read_cancelled", ended) + continue + } if readErr != nil && !errors.Is(readErr, layout.ErrHeadAbsent) { - h.log.Printf("blockmaster: deletion HEAD read deferred volume=%q layout_id=%q error=%v", id, rec.Spec.LayoutID, readErr) + h.log.Printf("blockmaster: deletion HEAD read deferred volume=%q layout_id=%q reason=head_read_failed error=%v", id, rec.Spec.LayoutID, readErr) continue } state := head.State @@ -134,6 +149,7 @@ func (h *Host) reconcileDeletedSpecVolumes(ctx context.Context, limited bool, no } var err error if state != layout.StateDeleting && state != layout.StateDeleted { + h.logRetirementSkip(limited, id, "head_not_deleting_or_deleted", fmt.Errorf("HEAD state=%q", state)) continue } h.noWork.Store(id, state) @@ -144,6 +160,7 @@ func (h *Host) reconcileDeletedSpecVolumes(ctx context.Context, limited bool, no // writers. Remote HEAD is monotone after the lease barrier/reservation. if !stores.Deletions.CommittedSnapshot(id) { h.workspaceMu.Unlock() + h.logRetirementSkip(limited, id, "reservation_changed", nil) continue } err = h.Publisher().RetireDeletedWorkspace(ctx, id) @@ -161,15 +178,72 @@ func (h *Host) reconcileDeletedSpecVolumes(ctx context.Context, limited bool, no delete(h.retirementNext, id) h.log.Printf("blockmaster: retired spec-removed volume metadata volume=%q head_state=%s reservation=committed", id, state) } + } else if state == layout.StateDeleting { + h.logRetirementSkip(limited, id, "delete_in_progress", nil) + } else { + h.logRetirementSkip(limited, id, "kept_by_spec", nil) } h.workspaceMu.Unlock() if err != nil { - h.log.Printf("blockmaster: deletion metadata retirement deferred volume=%q error=%v", id, err) + h.log.Printf("blockmaster: deletion metadata retirement deferred volume=%q reason=metadata_removal_failed error=%v", id, err) } } return nil } +// The authority's dated refusal is used only to schedule a second startup +// pass, never to prove a lease ended. A missing or changed hint fails closed; +// the actual pass always calls NoLiveWorkspaceLease again before reading HEAD. +func retirementLeaseBarrier(err error) (time.Time, bool) { + _, rest, ok := strings.Cut(err.Error(), "workspace delete: live until ") + if !ok { + return time.Time{}, false + } + stamp, _, ok := strings.Cut(rest, ": ") + if !ok { + return time.Time{}, false + } + at, parseErr := time.Parse(time.RFC3339Nano, stamp) + return at, parseErr == nil +} + +// Full startup passes report every skipped volume. The paced product scan +// retains its existing error logs without printing the whole inventory per tick. +func (h *Host) logRetirementSkip(limited bool, id, reason string, err error) { + if !limited && h.log != nil { + h.log.Printf("blockmaster: deletion retirement skipped volume=%q reason=%s error=%v", id, reason, err) + } +} + +// startPostFloorRetirement runs one more full pass even without the lifecycle +// product loop. Start owns this goroutine; Close cancels its timer and joins it +// before closing the stores. No retirement or lease guard is bypassed. +func (h *Host) startPostFloorRetirement(ctx context.Context) { + h.retirementMu.Lock() + at := h.retirementRetryAt + h.retirementMu.Unlock() + if at.IsZero() || h.specDesired == nil { + return + } + h.wg.Add(1) + go func() { + defer h.wg.Done() + timer := time.NewTimer(max(0, time.Until(at))) + defer timer.Stop() + h.log.Printf("blockmaster: post-floor deletion retirement scheduled retry_at=%s", at.UTC().Format(time.RFC3339Nano)) + select { + case <-ctx.Done(): + return + case <-timer.C: + } + if err := h.ReconcileDeletedSpecVolumes(ctx); err != nil { + h.log.Printf("blockmaster: post-floor deletion retirement stopped error=%v", err) + return + } + h.log.Printf("blockmaster: post-floor deletion retirement pass finished") + }() +} + // refreshHostDeletionProofs rebuilds only the requested host's missing NoWork // proofs. The permanent reservation makes a post-lease deleting/deleted/absent // HEAD monotone. A read failure retains work; this never retires volume data diff --git a/seaweed-block/core/host/master/standalone_retirement_test.go b/seaweed-block/core/host/master/standalone_retirement_test.go new file mode 100644 index 0000000000..53380d11d3 --- /dev/null +++ b/seaweed-block/core/host/master/standalone_retirement_test.go @@ -0,0 +1,188 @@ +package master + +import ( + "context" + "errors" + "fmt" + "log" + "runtime" + "slices" + "strings" + "sync/atomic" + "testing" + "time" + + "github.com/seaweedfs/seaweed-block/core/authority" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" + "github.com/seaweedfs/seaweed-block/core/lifecycle" + "github.com/seaweedfs/seaweed-block/core/rpc/control" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +// The standalone default has no lifecycle product tick. After the startup +// sweep meets the conservative reload floor, retirement must still run again. +func TestStandaloneRestartRetriesSpecRetirementAfterLeaseFloor(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("Linux lifecycle/authority directory fsync restart witness") + } + var now atomic.Int64 + now.Store(time.Now().Add(-2 * time.Minute).UnixNano()) + first, conn, ctx := reviewBindingHostBeforeStart(t, func(context.Context, string) (authority.WorkspaceHead, error) { + return authority.WorkspaceHead{Gen: 2}, authority.ErrWorkspaceHeadUnclaimed + }, func(h *Host) { + authority.WithWorkspaceLeaseConfig(30*time.Second, func() time.Time { return time.Unix(0, now.Load()) })(h.Publisher()) + }) + reviewCreate(t, conn, ctx, "gone") + ws := control.NewWorkspaceServiceClient(conn) + if _, err := ws.RegisterWorkspaceBinding(ctx, &control.WorkspaceBinding{VolumeId: "gone", ServerId: "node-a", DataAddr: "127.0.0.1:10000", CtrlAddr: "127.0.0.1:10001"}); err != nil { + t.Fatal(err) + } + if _, err := ws.PlaceWorkspace(ctx, &control.WorkspacePlacement{VolumeId: "gone", ServerId: "node-a", ReplicaId: "r1"}); err != nil { + t.Fatal(err) + } + reviewHeartbeat(t, conn, ctx, "gone", "node-a", "127.0.0.1:10000", "127.0.0.1:10001") + if _, err := first.RunLifecycleProductTick(); err != nil { + t.Fatal(err) + } + line := waitAuthorityLine(t, first.Publisher(), "gone") + if _, err := ws.RenewWorkspaceLease(ctx, &control.WorkspaceIdentity{VolumeId: "gone", ReplicaId: "r1", Epoch: line.Epoch, ServerId: "node-a"}); err != nil { + t.Fatal(err) + } + // The original grant really ended before the terminal delete. The fresh + // publisher below uses its normal clock and reconstructs its own floor. + now.Store(time.Now().UnixNano()) + if err := first.VolumeDeleteAuthority("gone", "delete-gone").Reserve(ctx); err != nil { + t.Fatal(err) + } + if err := first.Publisher().NoLiveWorkspaceLease(ctx, "gone"); err != nil { + t.Fatal(err) + } + if _, err := first.Lifecycle().Volumes.CreateVolume(lifecycle.VolumeSpec{VolumeID: "live", SizeBytes: 1 << 20, ReplicationFactor: 1}); err != nil { + t.Fatal(err) + } + if _, err := first.Lifecycle().Placements.ApplyPlan(lifecycle.PlacementPlan{VolumeID: "live", DesiredRF: 1, Candidates: []lifecycle.PlacementCandidate{{VolumeID: "live", ServerID: "node-b", ReplicaID: "r1", Source: lifecycle.PlacementSourceExistingReplica}}}); err != nil { + t.Fatal(err) + } + cfg := first.cfg + logs := &syncBuffer{} + cfg.Logger = log.New(logs, "", 0) + cfg.LifecycleProductLoop = false + var headReads atomic.Int32 + cfg.LayoutReadHead = func(_ context.Context, spec lifecycle.VolumeSpec) (layout.Head, error) { + if spec.VolumeID != "gone" { + t.Errorf("read unrelated unreserved volume %q", spec.VolumeID) + } + headReads.Add(1) + return layout.Head{State: layout.StateDeleted}, nil + } + closeTestMaster(t, first) + fresh, err := New(cfg) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { closeTestMaster(t, fresh) }) + ctx, cancel := context.WithTimeout(t.Context(), 75*time.Second) + defer cancel() + if err := fresh.Publisher().NoLiveWorkspaceLease(ctx, "gone"); err == nil { + t.Fatal("fixture did not reconstruct the restart floor") + } + if err := fresh.PruneUnusedSpecPlacements(ctx, nil); err != nil { + t.Fatal(err) + } + if err := fresh.ReconcileDeletedSpecVolumes(ctx); err != nil { + t.Fatal(err) + } + if _, ok := fresh.Lifecycle().Volumes.GetVolume("gone"); !ok { + t.Fatal("startup retired before the reload floor") + } + if headReads.Load() != 0 { + t.Fatal("startup read HEAD before proving the lease ended") + } + fresh.Start() + // No RetireHost RPC or product tick: either one would exercise a different + // path and could hide a missing standalone retry. + poll := time.NewTicker(20 * time.Millisecond) + defer poll.Stop() + for { + if _, ok := fresh.Lifecycle().Volumes.GetVolume("gone"); !ok { + break + } + select { + case <-poll.C: + case <-ctx.Done(): + t.Fatal("deleted spec-removed record remains after the restart floor without a product tick") + } + } + if _, ok := fresh.Lifecycle().Placements.GetPlacement("gone"); ok { + t.Fatal("retired volume still has a placement") + } + if _, ok := fresh.Publisher().VolumeAuthorityLine("gone"); ok { + t.Fatal("retired volume still has authority") + } + if !fresh.Lifecycle().Deletions.CommittedSnapshot("gone") { + t.Fatal("retirement removed the permanent tombstone") + } + if headReads.Load() != 1 { + t.Fatalf("retirement HEAD reads=%d, want one post-floor read", headReads.Load()) + } + if _, ok := fresh.Lifecycle().Volumes.GetVolume("live"); !ok { + t.Fatal("retirement removed an unreserved volume") + } + if work := fresh.volumesServedBy("node-a"); len(work) != 0 { + t.Fatalf("retired volume still holds host work: %v", work) + } + if work := fresh.volumesServedBy("node-b"); !slices.Equal(work, []string{"live"}) { + t.Fatalf("unrelated host work after retirement=%v, want only live", work) + } + for _, volume := range fresh.ObservationSnapshot(time.Now()).Volumes { + if volume.VolumeID == "gone" { + t.Fatalf("retired volume remains in status: %+v", volume) + } + } + freshConn, err := grpc.NewClient(fresh.Addr(), grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + t.Fatal(err) + } + defer freshConn.Close() + if _, err := control.NewLifecycleServiceClient(freshConn).RetireHost(ctx, &control.RetireHostRequest{ServerId: "node-a", Confirm: "node-a"}); err != nil { + t.Fatalf("retired volume still blocks retire-host: %v", err) + } + for _, reason := range []string{"reason=lease_not_proven_ended", "reason=not_reserved"} { + if !strings.Contains(logs.String(), reason) { + t.Fatalf("startup silently skipped work: missing %s in %s", reason, logs.String()) + } + } +} + +func TestRetirementLeaseBarrierIsOnlyASchedulingHint(t *testing.T) { + at := time.Now().Add(time.Minute).UTC() + for _, tc := range []struct { + err error + want bool + }{ + {fmt.Errorf("workspace delete: live until %s: lease expiry plus clock-skew margin has not elapsed", at.Format(time.RFC3339Nano)), true}, + {errors.New("workspace delete: authority records were skipped during recovery; lease absence is unknown"), false}, + {errors.New("workspace delete: lease persistence uncertain; restart required"), false}, + {errors.New("workspace delete: live until invalid: invalid hint"), false}, + } { + got, ok := retirementLeaseBarrier(tc.err) + if ok != tc.want || (ok && !got.Equal(at)) { + t.Fatalf("%v -> %s, %v; want scheduling hint=%v", tc.err, got, ok, tc.want) + } + } +} + +func TestPostFloorRetirementTimerJoinsOnCancellation(t *testing.T) { + ctx, cancel := context.WithCancel(t.Context()) + h := &Host{specDesired: map[string]bool{}, retirementRetryAt: time.Now().Add(time.Hour), log: log.New(&syncBuffer{}, "", 0)} + h.startPostFloorRetirement(ctx) + cancel() + done := make(chan struct{}) + go func() { h.wg.Wait(); close(done) }() + select { + case <-done: + case <-time.After(time.Second): + t.Fatal("cancel did not join the post-floor timer") + } +} diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index 33e9601a34..250b6dee62 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -146,7 +146,7 @@ flowchart LR | Bound | Deleting | a deletion reservation; the id is never created again | `core/host/master/services.go` `MarkVolumeDeleting` | `INV-VOL-ID-NO-REUSE-001` | | any authority line | DeleteReserved (permanent) | the existing lifecycle reservation is committed durably; then `mu -> leaseMu` publishes the exclusion. Publication, move issue, first grant, expired re-grant and renewal check it under their writer lock. Restart reloads every committed exclusion before serving. Deleting HEAD requires the granted or restart deadline plus skew to have ended, including unclaimed grants; the check returns a refusal rather than waiting | `core/authority/workspace_delete_reservation.go` `ReserveWorkspaceDeletion`, `NoLiveWorkspaceLease`; `core/host/master/volume_delete_authority.go`; `host.go` `New` | `INV-SNAPK-DELETE-GATE-001` | | any authority line, stores still awaited (stage 1) | DeleteReserved without the holder's acknowledgement | the master's record is marked first, durably and in the lock that ends the store wait; the mark freezes the record in stage 1 (the wait never ends after it, so the primary, whose assignment keeps awaiting the stores, never serves); the reservation then skips the live-lease refusal. Deleting HEAD waits out the lease as above. Past stage 1, also while the end of creation is unrecorded (the volume may be serving), the live-lease refusal stays | `core/host/master/volume_delete_authority.go` `Reserve`; `core/host/master/store_attestation.go` `markDeleteWithoutAck`, `awaited`; `core/authority/workspace_delete_reservation.go` `ReserveNeverCreatedWorkspaceDeletion` | `INV-WS-DELETE-WITHOUT-ACK-001` | -| DeleteReserved, removed from the desired spec | Retired metadata (reservation permanent) | no live lease, then a fresh bounded HEAD read proves deleted or absent; unread/live/deleting keeps the records. Remove authority durably, then placement and bindings, then the volume record; a crash retries the remaining removals. The store and its resweep inputs are untouched | `core/host/master/spec_retirement.go` `ReconcileDeletedSpecVolumes`; `core/authority/workspace_retirement.go` `RetireDeletedWorkspace` | `INV-SPEC-DELETE-RETIRE-001` | +| DeleteReserved, removed from the desired spec | Retired metadata (reservation permanent) | no live lease, then a fresh bounded HEAD read proves deleted or absent; unread/live/deleting keeps the records. Remove authority durably, then placement and bindings, then the volume record; a crash retries the remaining removals. A startup lease skip schedules one more pass after the latest observed barrier, also without the product loop; full passes log skips. The store and its resweep inputs are untouched | `core/host/master/spec_retirement.go` `ReconcileDeletedSpecVolumes`, `startPostFloorRetirement`; `core/authority/workspace_retirement.go` `RetireDeletedWorkspace` | `INV-SPEC-DELETE-RETIRE-001`, `INV-SPEC-DELETE-RETRY-001` | **Volume creation phase, in blockmaster's store record** (`core/host/master/store_attestation.go`, decided by `inCreationPhase` in `core/host/master/product_loop.go`). Every replacement entry (both promotion gates, the operator's failover and planned move, the rebalance) acts only on Established. @@ -1209,6 +1209,7 @@ Notes: | `INV-CUT-TIMER-SLOT-WAIT-001` | A periodic cut refused for held host slots, pending urgent work or an earlier ticket is a wait, not a failure: no backoff or minimum spacing; it retries at the next poll in ticket order, and status reports the wait until any later cut succeeds. Other errors keep the backoff. | M5 periodic trigger (before Admit) | `core/frontend/durable/provider_chunk.go` `cutPolicy.after`, `chunkLoop`; `core/hostlimit/limiter.go` `ErrSlotsHeld` | `TestCutPolicy_HostSlotBusyIsAWaitNotAFailure`, `TestCutPolicy_SuccessDuringSlotWaitEndsTheWait`, `TestCutWaitSlot_StatusEndsTheWaitAfterALaterCut`, `TestCutPolicy_TicketOrderWaitBound` (`core/frontend/durable/cut_policy_test.go`); `TestTimerCutRunsSoonAfterHostSlotFrees`, `TestSlotWaitEndsWithASuccessfulDetachSeal` (`core/frontend/durable/host_slot_wait_test.go`); `TestAdmitClosedDuringPoolAcquisitionIsRevoked` (`core/hostlimit/limiter_test.go`) | — | ACTIVE | | `INV-SNAPSHOT-ANSWER-COUNT-001` | Newly produced snapshot creation and listing answers omit the uncomputed chunk count; no manifest scan is added to answer a snapshot. | M9 snapshot answer projection (no transition change) | `core/frontend/chunkstore/control_types.go`, `api.go`; `core/host/volume/chunk_control.go` | `TestSnapshotAfter200MiBWritesOmitsUncomputedChunkCount` (`core/host/volume/snapshot_chunk_count_test.go`) | NONE (pure projection of the published snapshot; no authority or persisted format change) | STUB | | `INV-SPEC-DELETE-RETIRE-001` | Retire spec-removed metadata only under a permanent reservation after no-live-lease and a subsequent HEAD read proves deleted or absent. Read errors, live HEAD and deleting HEAD keep the records. Retirement never removes the reservation or store data. | M4 delete retirement | `core/host/master/spec_retirement.go`; `core/authority/workspace_retirement.go`, `authority_store_file.go` | `TestSpecRetirementReadsHeadOnlyAfterLeaseAndKeepsTombstone`, `TestSpecRetirementRequiresDeletedOrAbsentAndReadableHead`, `TestSpecRetirementDoesNotUseAbsentHeadWithoutReservation`, `TestRetirementKeepsReservationAndWaitsForLiveLease`, `TestFileAuthorityRetirementSurvivesReloadAndKeepsOtherRecords`, `TestSpecRetirementBackgroundBoundsReadsAndCachesTerminalProof`, `TestSpecRetirementLocalFailureDoesNotStopOtherVolumesOrProductTick` | DeleteRetire.ReadOK; DeleteRetire.Retire; DeleteRetire.HostRetire | STUB | +| `INV-SPEC-DELETE-RETRY-001` | Startup lease barriers schedule one more retirement pass after the latest observed barrier, independently of the product loop. The pass rechecks every lease and HEAD guard, logs skipped volumes, and is cancelled and joined before stores close. | M4 delete retirement scheduling | `core/host/master/host.go` `Start`, `Close`; `spec_retirement.go` `startPostFloorRetirement` | `TestStandaloneRestartRetriesSpecRetirementAfterLeaseFloor`, `TestRetirementLeaseBarrierIsOnlyASchedulingHint`, `TestPostFloorRetirementTimerJoinsOnCancellation` | DeleteRetire.ReadOK; DeleteRetire.Retire | STUB | | `INV-SPEC-UNUSED-PLACEMENT-001` | A spec startup prunes an undesired placement only before serving and with no volume record, authority line, binding or deletion reservation, and no skipped authority recovery. The desired spec and seed are one keep set. | M4 registration input | `cmd/blockmaster/main.go`; `core/host/master/spec_retirement.go` | `TestClusterSpecImportRemovesUnusedPlacementMissingFromSpec`, `TestClusterSpecCleanupKeepsRecordsBindingsAuthorityAndSeed` | NONE (registration-only cleanup before controller activity) | STUB | | `INV-CHECK-DELETING-001` | A post-lease reserved volume with HEAD deleting, deleted or absent holds no serving work. Its status is informational and checks issue no lease or holder requests for it. Another volume's failures remain visible. | M9 delete observation | `core/host/master/observation_snapshot.go`, `journal_isolation.go`; `cmd/sw-block/shell_check.go` | `TestSpecRetirementRequiresDeletedOrAbsentAndReadableHead`, `TestSpecRetirementReadsHeadOnlyAfterLeaseAndKeepsTombstone`, `TestClusterCheckDoesNotProbeDeletingOrDeletedVolumes` | DeleteRetire.HostRetire | STUB | | `INV-CLI-DELETE-RETRY-001` | Only the final lease barrier after a committed volume-delete reservation permits retryable true/exit 75 at its horizon. A live-holder Reserve refusal requires stopping the volume first (not_admitted, non-retryable, exit 1). No lease guard is bypassed. | M9 delete admission result projection | `cmd/sw-block/chunk_volume_delete.go` `authorityErr`; `cmd/sw-block/chunk.go` `chunkResult` | `TestVolumeDeleteAdmissionRetryAnswer`; `TestOpsChunkVolumeDeleteRefusalSaysNothingWasPersisted` | MoveAdmission.DelRead; MoveAdmission.DelMark (unchanged guards) | STUB | diff --git a/seaweed-block/docs/operations-manual.md b/seaweed-block/docs/operations-manual.md index 563c88e674..78d95f28ca 100644 --- a/seaweed-block/docs/operations-manual.md +++ b/seaweed-block/docs/operations-manual.md @@ -485,7 +485,8 @@ A deleted name is never created again. To delete the restored volume `v2`: - **`retryable: false`, exit 1, "stop the volume first":** blockmaster refused to admit the delete because a serving holder still holds the lease. Do steps 1 and 2 first, then run the same command again. - The delete removes the volume's data and snapshots. A small tombstone stays (`HEAD`, `VOLUME` and empty - directories under `/swblock/chunks/v2-/`): it keeps the name from being created again. Do not remove it. + directories under `/swblock/chunks/v2-/`). Do not remove it. In v1.1.x a deleted volume's id is not + reusable: create the replacement under a new name. Name reuse is planned for v1.2. - In v1.1.0, blockmaster keeps the deleted volume's authority record. After step 4, cluster status stays `degraded` for it (`observed_replicas_below_desired`), and `ops workspace show --volume v2` answers `workspace: volume is being deleted`, and `cluster.check` keeps failing the deleted volume's holder checks @@ -494,7 +495,10 @@ A deleted name is never created again. To delete the restored volume `v2`: - From v1.1.1, the deleted volume reads `deleting` (reason `deletion_reserved`, `delete committed; awaiting metadata retirement`), the cluster stays `ok`, and `cluster.check` exits 0 (its holder checks print `deleting ... no serving checks apply`). `ops workspace show --volume v2` still answers `workspace: volume is being - deleted`. blockmaster retires the volume's records at its next start after step 4. + deleted`. After step 4, blockmaster retries metadata retirement once its restart lease floor has passed, + even with the lifecycle product loop disabled. With the default lease settings this is about 50 seconds after + restart; the volume disappears from status after retirement and no longer blocks `cluster retire-host`. + Skipped retirement work is logged with its reason. 4. **Remove the volume from the cluster spec** (edit it as root, as in section 2), restart blockmaster, and remove the settings file on every host that ran the volume. If it was the last volume, leave the `volumes:` key with no diff --git a/seaweed-block/docs/releases/v1.1.1.md b/seaweed-block/docs/releases/v1.1.1.md index b1bca2c120..aec124a2a3 100644 --- a/seaweed-block/docs/releases/v1.1.1.md +++ b/seaweed-block/docs/releases/v1.1.1.md @@ -23,6 +23,11 @@ v1.1.1 is a fix release of the v1.1 line. None of its changes alters a stored fo failure), not 1 (#987). An unanswered cut or plain-detach admission is `outcome_unknown`, exit 3, because the request may have been admitted; see [CLI and errors](#cli-and-errors). +- **Deleted volume identities:** in v1.1.x a deleted volume's id is not reusable; create a replacement under a new + name and retain the deletion tombstone. Name reuse is planned for v1.2. After a master restart, standalone + blockmaster retries metadata retirement once the restart lease floor passes (about 50 seconds with defaults), + so a completed, spec-removed delete disappears from status and stops holding host work without a product tick. + ## Snapshots and cuts - A manual cut (`sw-block ops chunk cut`) no longer fails at a fixed total timeout while it is making progress. Its diff --git a/seaweed-block/docs/time-bounds.tsv b/seaweed-block/docs/time-bounds.tsv index 82a7b26887..19111b00f0 100644 --- a/seaweed-block/docs/time-bounds.tsv +++ b/seaweed-block/docs/time-bounds.tsv @@ -204,6 +204,7 @@ core/host/master/host.go New http.Server.IdleTimeout 1 per-call NONE: no model r core/host/master/probe_round.go roundEvidenceProvider.round time.NewTimer 1 per-call FencingRound.Deliver; FencingRound.Open one probe round's evidence wait core/host/master/services.go services.deleteHolderEvidence context.WithTimeout 1 per-call FormatGate.Report one RPC or request core/host/master/spec_retirement.go Host.reconcileDeletedSpecVolumes context.WithTimeout 1 per-call DeleteRetire.ReadOK one fresh HEAD read after the no-live-lease barrier +core/host/master/spec_retirement.go Host.startPostFloorRetirement time.NewTimer 1 control-timer DeleteRetire.ReadOK; DeleteRetire.Retire one startup retry at the latest authority lease barrier; every guard is rechecked core/host/master/spec_retirement.go Host.refreshHostDeletionProofs context.WithTimeout 1 per-call DeleteRetire.ReadOK one post-lease HEAD read for a requested host candidate; error retains work core/host/master/workspace_service.go services.AckWorkspaceRevoked context.WithTimeout 1 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request core/host/master/workspace_service.go services.MoveWorkspace context.WithTimeout 1 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request