diff --git a/seaweed-block/cmd/blockvolume/capture_floor_test.go b/seaweed-block/cmd/blockvolume/capture_floor_test.go index 94cf3abfbd..b653eb446e 100644 --- a/seaweed-block/cmd/blockvolume/capture_floor_test.go +++ b/seaweed-block/cmd/blockvolume/capture_floor_test.go @@ -12,7 +12,7 @@ import ( // so 60 s is refused; a program that sets it to 30 s before parsing flags // accepts 30 s and refuses 29 s. The refusal names the floor in force. func TestCaptureIntervalFloor(t *testing.T) { - base := append(phase150RequiredBlockvolumeArgs(), "--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1") + base := append(phase150RequiredBlockvolumeArgs(), "--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1") parse := func(iv string) error { _, err := parseFlags(append(append([]string{}, base...), "--chunk-capture-interval="+iv)) return err diff --git a/seaweed-block/cmd/blockvolume/chunk_lease_required_test.go b/seaweed-block/cmd/blockvolume/chunk_lease_required_test.go new file mode 100644 index 0000000000..5ea71e7644 --- /dev/null +++ b/seaweed-block/cmd/blockvolume/chunk_lease_required_test.go @@ -0,0 +1,23 @@ +package main + +import ( + "strings" + "testing" +) + +func TestChunkVolumeRequiresWorkspaceLeaseBeforeStart(t *testing.T) { + base := append(phase150RequiredBlockvolumeArgs(), "--durable-root="+t.TempDir(), "--durable-impl=walstore-chunk", "--chunk-filer=filer:18888") + for _, extra := range [][]string{nil, {"--workspace-lease=false"}} { + _, err := parseFlags(append(append([]string{}, base...), extra...)) + if err == nil || !strings.Contains(err.Error(), "--workspace-lease is required") || !strings.Contains(err.Error(), "forced move") { + t.Fatalf("unleased chunk start: %v", err) + } + } + if _, err := parseFlags(append(base, "--workspace-lease")); err != nil { + t.Fatalf("leased chunk start: %v", err) + } + plain := append(phase150RequiredBlockvolumeArgs(), "--durable-root="+t.TempDir(), "--durable-impl=walstore") + if _, err := parseFlags(plain); err != nil { + t.Fatalf("plain walstore unexpectedly requires a workspace lease: %v", err) + } +} diff --git a/seaweed-block/cmd/blockvolume/chunk_remote_test.go b/seaweed-block/cmd/blockvolume/chunk_remote_test.go index 579b33e103..ad7c1ead84 100644 --- a/seaweed-block/cmd/blockvolume/chunk_remote_test.go +++ b/seaweed-block/cmd/blockvolume/chunk_remote_test.go @@ -18,7 +18,7 @@ func TestWALStoreChunkFlags(t *testing.T) { base := func(extra ...string) []string { return append(phase150RequiredBlockvolumeArgs(), extra...) } - f, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", + f, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=127.0.0.1:18888", "--chunk-capture-interval=5m")) if err != nil { t.Fatalf("walstore-chunk with a filer: %v", err) @@ -26,12 +26,12 @@ func TestWALStoreChunkFlags(t *testing.T) { if f.chunk.filer != "127.0.0.1:18888" || f.chunk.path != defaultChunkPath || f.chunk.captureInterval != 5*time.Minute || f.chunk.controlEndpoint { t.Fatalf("parsed chunk flags = %+v", f.chunk) } - f, err = parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", + f, err = parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--status-addr=127.0.0.1:0", "--chunk-control-endpoint")) if err != nil || !f.chunk.controlEndpoint { t.Fatalf("walstore-chunk with the control endpoint: %+v %v", f.chunk, err) } - d, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1")) + d, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1")) if err != nil { t.Fatal(err) } @@ -39,15 +39,15 @@ func TestWALStoreChunkFlags(t *testing.T) { t.Fatalf("scheduler defaults: capture %s, maintenance %s, cleaning %v; want capture off (0), maintenance 1h and the cleaning on", d.chunk.captureInterval, d.chunk.maintenanceInterval, d.chunk.automaticGC) } // The cleaning is on by default; the one way to turn it off is explicit. - noClean, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-maintenance-gc=false")) + noClean, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-maintenance-gc=false")) if err != nil || noClean.chunk.automaticGC || noClean.chunk.maintenanceInterval != time.Hour { t.Fatalf("turning the cleaning off: %+v %v", noClean.chunk, err) } - on, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-capture-interval=15m")) + on, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-capture-interval=15m")) if err != nil || on.chunk.captureInterval != 15*time.Minute { t.Fatalf("opting in to a 15m periodic cut: %+v %v", on.chunk, err) } - off, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", + off, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-capture-interval=0")) if err != nil || off.chunk.captureInterval != 0 { t.Fatalf("disabling the timer: %+v %v", off.chunk, err) @@ -56,27 +56,30 @@ func TestWALStoreChunkFlags(t *testing.T) { t.Fatalf("walstore with the chunk defaults untouched: %v", err) } refused := map[string][]string{ - "no filer": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk"), - "no durable root": base("--durable-impl=walstore-chunk", "--chunk-filer=127.0.0.1:18888"), - "relative path": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-path=swblock"), - "root path": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-path=/"), - "below OSS capture floor": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-capture-interval=4m59s"), - "60 s in an OSS build": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-capture-interval=60s"), - "negative maintenance": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-maintenance-interval=-1s"), - "negative interval": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-capture-interval=-1s"), + "no filer": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease"), + "no durable root": base("--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=127.0.0.1:18888"), + "relative path": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-path=swblock"), + "root path": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-path=/"), + "below OSS capture floor": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-capture-interval=4m59s"), + "60 s in an OSS build": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-capture-interval=60s"), + "negative maintenance": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-maintenance-interval=-1s"), + "negative interval": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-capture-interval=-1s"), "chunk flag on walstore": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore", "--chunk-filer=x:1"), "chunk path on walstore": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore", "--chunk-path=/other"), "control endpoint on walstore": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore", "--status-addr=127.0.0.1:0", "--chunk-control-endpoint"), - "control endpoint without a status listener": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", + "control endpoint without a status listener": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-control-endpoint"), - "zero upload concurrency": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-upload-concurrency=0"), - "too many uploads": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-upload-concurrency=65"), + "zero upload concurrency": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-upload-concurrency=0"), + "too many uploads": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-upload-concurrency=65"), "interval on walstore": base("--durable-root=/tmp/sw-block", "--durable-impl=walstore", "--chunk-capture-interval=5s"), } for name, args := range refused { - if _, err := parseFlags(args); err == nil { + _, err := parseFlags(args) + if err == nil { t.Errorf("%s: parseFlags succeeded; want an error", name) + } else if name == "no filer" && !strings.Contains(err.Error(), "requires --chunk-filer") { + t.Errorf("missing filer refused for wrong reason: %v", err) } } } @@ -88,7 +91,7 @@ func TestChunkDetachPrecopyFlagRefused(t *testing.T) { base := func(extra ...string) []string { return append(phase150RequiredBlockvolumeArgs(), extra...) } - valid := []string{"--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", + valid := []string{"--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--status-addr=127.0.0.1:0", "--chunk-control-endpoint"} f, err := parseFlags(base(valid...)) if err != nil || f.chunk.detachPrecopy { @@ -257,7 +260,7 @@ func (*layoutAttachFiler) Get(context.Context, string) ([]byte, error) { // replica id are different holders (B9 W2 appendix). func TestChunkHolderIsServerAndReplica(t *testing.T) { f, err := parseFlags(append(phase150RequiredBlockvolumeArgs(), "--durable-root=/tmp/sw-block", - "--durable-impl=walstore-chunk", "--chunk-filer=x:1")) + "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1")) if err != nil { t.Fatal(err) } @@ -270,7 +273,7 @@ func TestChunkHolderIsServerAndReplica(t *testing.T) { // copy-on-write budget (M5 Stage), so the flag never had an effect. A unit // that still passes it fails at start. func TestChunkDirtyThresholdFlagIsGone(t *testing.T) { - args := append(phase150RequiredBlockvolumeArgs(), "--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-dirty-threshold=512") + args := append(phase150RequiredBlockvolumeArgs(), "--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1", "--chunk-dirty-threshold=512") if _, err := parseFlags(args); err == nil || !strings.Contains(err.Error(), "flag provided but not defined") { t.Fatalf("--chunk-dirty-threshold: %v; want flag provided but not defined", err) } @@ -284,7 +287,7 @@ func TestChunkSnapshotScheduleFlag(t *testing.T) { return append(phase150RequiredBlockvolumeArgs(), extra...) } chunk := func(extra ...string) []string { - return base(append([]string{"--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1"}, extra...)...) + return base(append([]string{"--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1"}, extra...)...) } d, err := parseFlags(chunk()) if err != nil || d.chunk.snapshotSchedule != (snapshotSchedule{period: 24 * time.Hour, keep: 7}) { diff --git a/seaweed-block/cmd/blockvolume/chunk_rf1_guard_test.go b/seaweed-block/cmd/blockvolume/chunk_rf1_guard_test.go index 0d0fd71741..1d24f4395a 100644 --- a/seaweed-block/cmd/blockvolume/chunk_rf1_guard_test.go +++ b/seaweed-block/cmd/blockvolume/chunk_rf1_guard_test.go @@ -12,7 +12,7 @@ import ( // (the master's workspace RPCs already do). func TestChunkVolumeRefusesReplicationAckAtStart(t *testing.T) { base := []string{"--master", "127.0.0.1:1", "--server-id", "node-a", "--volume-id", "v1", "--replica-id", "r1", "--data-addr", "127.0.0.1:9100", "--ctrl-addr", "127.0.0.1:9101"} - chunk := append(append([]string{}, base...), "--durable-root", t.TempDir(), "--durable-impl", "walstore-chunk", "--chunk-filer", "127.0.0.1:18888") + chunk := append(append([]string{}, base...), "--durable-root", t.TempDir(), "--durable-impl", "walstore-chunk", "--workspace-lease", "--chunk-filer", "127.0.0.1:18888") for _, ack := range []string{"sync-quorum", "sync-all"} { _, err := parseFlags(append(append([]string{}, chunk...), "--replication-ack", ack)) if err == nil || !strings.Contains(err.Error(), "single-replica") || !strings.Contains(err.Error(), "RF1 only") { diff --git a/seaweed-block/cmd/blockvolume/cleaning_default_test.go b/seaweed-block/cmd/blockvolume/cleaning_default_test.go index 693cff3e9e..1e617dfac4 100644 --- a/seaweed-block/cmd/blockvolume/cleaning_default_test.go +++ b/seaweed-block/cmd/blockvolume/cleaning_default_test.go @@ -29,7 +29,7 @@ func (cleaningView) Projection() frontend.Projection { // current root names and stops growing. func TestDefaultConfigCleansAfterEachSnapshotDelete(t *testing.T) { ctx := context.Background() - d, err := parseFlags(append(phase150RequiredBlockvolumeArgs(), "--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1")) + d, err := parseFlags(append(phase150RequiredBlockvolumeArgs(), "--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1")) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/cmd/blockvolume/existing_geometry_compat_test.go b/seaweed-block/cmd/blockvolume/existing_geometry_compat_test.go index 6c69d7656f..eb82e9925f 100644 --- a/seaweed-block/cmd/blockvolume/existing_geometry_compat_test.go +++ b/seaweed-block/cmd/blockvolume/existing_geometry_compat_test.go @@ -91,7 +91,7 @@ func TestExistingDurableVolumeDisappearsDoesNotCreateFromIgnoredFlags(t *testing } args := append(phase150RequiredBlockvolumeArgs(), "--volume-id=v1", "--durable-root="+root, "--durable-impl="+string(impl), "--durable-blocks=4294967297") if impl == durable.ImplWALStoreChunk { - args = append(args, "--chunk-filer=127.0.0.1:18888") + args = append(args, "--chunk-filer=127.0.0.1:18888", "--workspace-lease") } f, err := parseFlags(args) if err != nil { diff --git a/seaweed-block/cmd/blockvolume/host_limit_test.go b/seaweed-block/cmd/blockvolume/host_limit_test.go index 939050f42e..5787520c21 100644 --- a/seaweed-block/cmd/blockvolume/host_limit_test.go +++ b/seaweed-block/cmd/blockvolume/host_limit_test.go @@ -6,7 +6,7 @@ import ( ) func TestHostCutLimitFlags(t *testing.T) { - base := append(phase150RequiredBlockvolumeArgs(), "--durable-root="+t.TempDir(), "--durable-impl=walstore-chunk", "--chunk-filer=x:1") + base := append(phase150RequiredBlockvolumeArgs(), "--durable-root="+t.TempDir(), "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1") dir := t.TempDir() args := append(append([]string{}, base...), "--host-limit-dir="+dir, "--host-limit-normal-slots=2", "--host-limit-urgent-slots=1") f, e := parseFlags(args) diff --git a/seaweed-block/cmd/blockvolume/hydration_flags_test.go b/seaweed-block/cmd/blockvolume/hydration_flags_test.go index 6d37a85eb7..6fd5dc2377 100644 --- a/seaweed-block/cmd/blockvolume/hydration_flags_test.go +++ b/seaweed-block/cmd/blockvolume/hydration_flags_test.go @@ -3,7 +3,7 @@ package main import "testing" func TestChunkHydrationFlagsAreConfigurable(t *testing.T) { - base := append(phase150RequiredBlockvolumeArgs(), "--durable-root=hydration-test", "--durable-impl=walstore-chunk", "--chunk-filer=x:1") + base := append(phase150RequiredBlockvolumeArgs(), "--durable-root=hydration-test", "--durable-impl=walstore-chunk", "--workspace-lease", "--chunk-filer=x:1") f, err := parseFlags(append(base, "--chunk-hydration-workers=3", "--chunk-hydration-queue-depth=17")) if err != nil || f.chunk.hydrationWorkers != 3 || f.chunk.hydrationQueueDepth != 17 { t.Fatalf("hydration limits: %+v err=%v", f.chunk, err) diff --git a/seaweed-block/cmd/blockvolume/main.go b/seaweed-block/cmd/blockvolume/main.go index 8b55eea573..504b30ac57 100644 --- a/seaweed-block/cmd/blockvolume/main.go +++ b/seaweed-block/cmd/blockvolume/main.go @@ -198,7 +198,7 @@ func parseFlags(args []string) (flags, error) { fs.StringVar(&f.ctrlAddr, "ctrl-addr", "", "control-path address (required)") fs.DurationVar(&f.hbInterval, "heartbeat-interval", 2*time.Second, "heartbeat send interval") fs.DurationVar(&f.recoverTimeout, "recover-timeout", volume.DefaultRecoverTimeout, "maximum inactivity without new completed recovery or attach work for a primary-assigned replica before it reports unhealthy (recovery_timeout); not a total startup deadline") - fs.BoolVar(&f.workspaceLease, "workspace-lease", false, "walstore-chunk workspace: require host-owned master lease; fail closed when unavailable") + fs.BoolVar(&f.workspaceLease, "workspace-lease", false, "required for walstore-chunk: require host-owned master lease; fail closed when unavailable") fs.BoolVar(&f.printReadyLine, "t0-print-ready", false, "internal test-only: emit one structured JSON line on stdout on first assignment") fs.BoolVar(&f.enableT1Readiness, "t1-readiness", false, "enable readiness bridge (HealthyPathExecutor) so adapter projection reaches Healthy") fs.StringVar(&f.statusAddr, "status-addr", "", "address for the status HTTP endpoint (e.g. 127.0.0.1:0); empty disables") @@ -328,6 +328,9 @@ func parseFlags(args []string) (flags, error) { if err := validateChunkFlags(f); err != nil { return flags{}, err } + if f.durableImpl == "walstore-chunk" && !f.workspaceLease { + return flags{}, fmt.Errorf("--workspace-lease is required for walstore-chunk: without a master lease two writers can acknowledge I/O and an old holder can lose acknowledged writes after a forced move; restart with --workspace-lease") + } if f.durableWALMultiBlockRecords { if f.durableRoot == "" { return flags{}, fmt.Errorf("--durable-wal-multiblock-records requires --durable-root") diff --git a/seaweed-block/cmd/blockvolume/workspace_flags_test.go b/seaweed-block/cmd/blockvolume/workspace_flags_test.go index 6ccd20d0ef..f4429e1389 100644 --- a/seaweed-block/cmd/blockvolume/workspace_flags_test.go +++ b/seaweed-block/cmd/blockvolume/workspace_flags_test.go @@ -12,9 +12,8 @@ func TestWorkspaceLeaseFlagIsExplicitAndChunkOnly(t *testing.T) { t.Fatal("workspace lease accepted without walstore-chunk") } chunk := append(append([]string{}, base...), "--durable-root", t.TempDir(), "--durable-impl", "walstore-chunk", "--chunk-filer", "127.0.0.1:18888") - disabled, err := parseFlags(chunk) - if err != nil || disabled.workspaceLease { - t.Fatal("ordinary chunk volume opted in", err) + if _, err := parseFlags(chunk); err == nil { + t.Fatal("chunk volume started without its required workspace lease") } enabled, err := parseFlags(append(chunk, "--workspace-lease")) if err != nil || !enabled.workspaceLease { diff --git a/seaweed-block/deploy/config/blockvolume.env b/seaweed-block/deploy/config/blockvolume.env index 5d0a211566..45d8419b41 100644 --- a/seaweed-block/deploy/config/blockvolume.env +++ b/seaweed-block/deploy/config/blockvolume.env @@ -121,7 +121,7 @@ SWB_CHUNK_UPLOAD_CONCURRENCY=8 # snapshots, snapshot/delete, detach) on the status listener; needs # SWB_STATUS_ADDR. SWB_CHUNK_CONTROL_ENDPOINT=false -# --workspace-lease (default false). Require a host-owned master lease; fail +# --workspace-lease (default false; REQUIRED true for walstore-chunk). Require a host-owned master lease; fail # closed when it is unavailable. Needs walstore-chunk and --workspace-rpc on # blockmaster. SWB_WORKSPACE_LEASE=false diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index e78f6bc219..1c200fb604 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -823,6 +823,7 @@ Notes: | `INV-VOL-GEOMETRY-FLAGS-RECORD-001` | A create-mode start whose `--durable-blocks`/`--durable-blocksize` disagree with the volume record exits 78 before any local store exists; an existing store is checked only at attach; an absent record keeps the create path; an unread record exits 75 (filer failed) or 78 (corrupt). | blockvolume startup (before the durable provider) | `cmd/blockvolume/main.go`; `cmd/blockvolume/chunk_remote.go` `geometryFlagsRefusal`; `core/frontend/chunkstore/layout/volume.go`, `start.go`, `create.go`; `core/frontend/chunkstore/catalog_b.go` | `TestGeometryFlagsRefusalComparesTheRecord`, `TestVolumeRequiresGeometry`, `TestVolumeGeometryChecksAndIsImmutable`, `TestStartGeometryMismatchPrecedesClaim`, `TestBCatalogRestoreCopiesVolumeGeometry`, `TestVolumeGeometryLivesOnlyInVolume` | K3: immutable required VOLUME geometry; Start checks the local persisted shape before claim; restores copy source geometry; no resize or compatibility path. | ACTIVE | | `INV-WS-STALE-LOCAL-ROOT-001` | An old or rolled-back local root is refused by `layout.Start` before serving; synchronous and deferred attach end without retry and report the typed stale-root error and cure. A fresh root at its own epoch likewise ends with `ErrMissingLocalRoot` and its cure. | M4 Claiming → Refused | `core/frontend/durable/provider_layout.go` `startLayoutRoot`; `core/frontend/durable/provider_chunk.go` `recoverChunk`, `chunkAuthorityWait`; `core/frontend/durable/provider_startup.go` `endChunkStartup` | `TestLayoutProviderRefusesEmptyOwnEpochAndRemountedOldRoot`, `TestFinalLayoutStartRefusalTable` (`core/frontend/durable/provider_layout_test.go`, `provider_layout_start_class_test.go`) | — | ACTIVE | | `INV-WS-ONE-PROCESS-PER-HOST-001` | One host runs at most one live blockvolume per volume: each takes the volume's exclusive host lock before its store opens and holds it until the store closes; a second is refused before it opens anything, whatever its `--durable-root`. | M4 (start) → Attaching, Refused | `core/frontend/durable/provider.go` `DurableProvider.lockVolumeOnHost` | `TestOneLiveProcessPerVolumePerHost`, `TestHostVolumeLockDirectoryCreatedOrRefused`, `TestHostVolumeLockRefusesNonDirectoryLockPath`, `TestHostVolumeLockTakesReadOnlyLockFile` (`core/frontend/durable/one_process_per_volume_test.go`); `TestHostVolumeLockCreatesParent0755AndLocks0700`, `TestHostVolumeLockKeepsExistingDirectoryModes` (`core/frontend/durable/volume_lock_parent_mode_test.go`); `TestVolumeLockDirTestOnlyRefusedUnderSystemd` (`cmd/blockvolume/volume_lock_flag_test.go`) | — | ACTIVE | +| `INV-CHUNK-LEASE-REQUIRED-001` | Blockvolume refuses walstore-chunk startup without --workspace-lease before any host or store is opened. The refusal names concurrent acknowledging writers and acknowledged-write loss after a forced move; plain walstore startup is unchanged. | M4 startup → Refused | `cmd/blockvolume/main.go` `parseFlags` | `TestChunkVolumeRequiresWorkspaceLeaseBeforeStart` | — | ACTIVE | | `INV-WS-SINGLE-FILER-001` | A chunk volume starts only when `--chunk-filer` is the only filer of its group: a master listing another filer or several refuses at once, whichever master answers first; a filer no master lists within 60 s is refused. A startup census, not a fence: a filer added to the group later is not detected. | M4 (startup) → Refused | `core/frontend/chunkstore/single_filer.go` `CheckSingleFiler`; `cmd/blockvolume/chunk_remote.go` `newChunkWiring`; `cmd/sw-block/chunk.go` `refuseUnlessSingleFiler` | `TestCheckSingleFilerRefusesAnotherOrSeveralFilers`, `TestCheckSingleFilerFailsClosed`, `TestCheckSingleFilerFavourableThenStalledRefuses`, `TestIsTargetComparesScopedAddresses`, `TestCheckSingleFilerPasses` (`core/frontend/chunkstore/single_filer_test.go`), `TestChunkWiringRefusesAMultiFilerGroup` (`cmd/blockvolume/single_filer_test.go`), `TestOpsChunk_WritingCommandsRunTheSingleFilerCheck` (`cmd/sw-block/chunk_start_check_test.go`), `TestOpsChunk_VerifyRunsTheSingleFilerCheck` (`cmd/sw-block/chunk_verify_test.go`) | — | ACTIVE | | `INV-WS-LEASE-REGRANT-001` | Re-grant after expiry keeps the same holder and epoch, with no pending move or revocation, a certain store, and one durable write after the horizon/deadline plus skew barrier. Restart begins a new session and voids the old; ordinary reopen keeps HEAD identity (epoch, holder, claim) unchanged. | M2 Expired → Granted; M9 Start | `core/authority/workspace_lease_view.go` `regrantWorkspaceLease`; `core/authority/workspace.go` `forcedMoveBarrierLocked`; `core/frontend/chunkstore/layout/start.go` `Start` | `TestWorkspaceLeaseExpiredSameHolderRegrantIsDurable`, `TestWorkspaceLeaseRegrantWaitsForFullSkew`, `TestWorkspaceLeaseRegrantDefeatsAlreadyPassedForcedPreflight`, `TestWorkspaceLeaseForcedIssueDefeatsOldHolderRegrant`, `TestWorkspaceLeaseRegrantWaitsForDurabilityAndLatchesFailure` (`core/authority/workspace_regrant_test.go`); `TestWorkspaceLeaseRegrantPreservesLocalLogThroughFirstCut` (`core/authority/workspace_regrant_storage_test.go`); `TestStart_OwnEpochFreshRootRefusedBeforeClaim`, `TestStart_OwnEpochSameRootContinues` (`core/frontend/chunkstore/layout/start_test.go`); `TestClaim_WritesItsClaimID`, `TestRunClaim_VoidsTheOldSession` (`core/frontend/chunkstore/layout/claim_test.go`); `TestLocalReopenClaimsBeforeServing` (`core/frontend/durable/provider_reopen_belt_test.go`) | `WorkspaceRegrant` `NoDualServingInc`, `RegrantNoLoss`, `DiskCoversMemory`; `INV-SNAPK-START-ROOT-001` | ACTIVE | | `INV-WS-LEASE-001` | A host admits frontend I/O and cuts only under an unexpired lease for its exact `{volume, replica, epoch}`; a fenced guard never reopens, even on a late renewal reply. | M4 lease guard: Valid → Fenced | `core/host/volume/workspace_lease.go` `permits`, `Refresh` | `TestWorkspaceLeaseExpiryFencesWithoutTimerAndCannotReopen`, `TestWorkspaceDelayedRenewalCannotUndoExpiry` (`core/host/volume/workspace_lease_test.go`); `TestWorkspaceHostRequiresLeaseBeforeFrontendAndCut` (`core/host/volume/workspace_runtime_test.go`); `TestWorkspacePausedGranteeRefusedAtAttach` (`core/host/master/workspace_paused_grantee_test.go`) | `WorkspaceTakeover` `NoDualServing` | ACTIVE | diff --git a/seaweed-block/docs/standalone-deployment.md b/seaweed-block/docs/standalone-deployment.md index 93174828dd..0529884ca4 100644 --- a/seaweed-block/docs/standalone-deployment.md +++ b/seaweed-block/docs/standalone-deployment.md @@ -287,7 +287,11 @@ listener before it has an assignment. Without one, the status shows | No error in either log, and `"Epoch":0` stays | `--expected-slots-per-volume` differs from the slot count (step 2), or `--server-id` or `--replica-id` differ from the slot (step 3) | | blockmaster logs `authority: rejected ask ...: workspace publication: no lifecycle VolumeRecord for v1; register it (CreateVolume) before publishing` | blockmaster runs with `--lifecycle-store`: a topology slot is then not enough, the volume also needs a volume record (below) | -**Workspace lease volumes (`--workspace-lease`).** Besides the steps above, +**Workspace lease volumes (`--workspace-lease`).** The flag is required for every +`--durable-impl=walstore-chunk` volume. Blockvolume refuses to start without it: +unleased holders can both acknowledge writes, and an old holder can lose +acknowledged writes after a forced move. Plain walstore volumes do not require +this flag. Besides the steps above, blockmaster needs `--workspace-rpc`, `--chunk-filer` (and blockvolume's `--chunk-path`, when not the default) and `--lifecycle-store`, and the volume needs a single-replica volume record in that store. To create and place an RF1 volume online on an already registered @@ -430,7 +434,7 @@ volume or prove frontend readiness. | `SWB_CHUNK_SNAPSHOT_SCHEDULE` | `--chunk-snapshot-schedule` | `daily:7` | Scheduled named snapshots: `daily:N` or `weekly:N` (one per period at a per-volume offset, the newest N kept), or `off` | | `SWB_CHUNK_UPLOAD_CONCURRENCY` | `--chunk-upload-concurrency` | `8` | Parallel chunk uploads (1..64) | | `SWB_CHUNK_CONTROL_ENDPOINT` | `--chunk-control-endpoint` | `false` | `/chunk/*` routes on the status listener | -| `SWB_WORKSPACE_LEASE` | `--workspace-lease` | `false` | Require a master lease; fail closed without one | +| `SWB_WORKSPACE_LEASE` | `--workspace-lease` | `false` | Required for walstore-chunk: require a master lease; fail closed without one | | `SWB_VOLUME_EXTRA_ARGS` | any | empty | Other flags (Kubernetes gate and source-gated flags) | The `--chunk-*` and `--workspace-lease` flags are refused unless diff --git a/seaweed-block/docs/volume-lifecycle.md b/seaweed-block/docs/volume-lifecycle.md index 6e7a469659..aa343aa4cc 100644 --- a/seaweed-block/docs/volume-lifecycle.md +++ b/seaweed-block/docs/volume-lifecycle.md @@ -59,7 +59,7 @@ For a workspace volume that can change host, this page adds three things. | Answer | Setup | What this page offers | |---|---|---| | exit 0, `volume: v1 (query snapshot, ...)` | cluster spec with a lifecycle store and workspace RPCs | everything below | -| exit 1, ends with `workspace RPC disabled` or `lifecycle store unavailable` | `--topology` only | **nothing on this page.** With `--workspace-lease` the volume never gets a lease and never serves; without it, it serves on its host but cannot be moved: neither the planned hand-over nor the forced move works | +| exit 1, ends with `workspace RPC disabled` or `lifecycle store unavailable` | `--topology` only | **nothing on this page.** The volume never gets a lease and never serves. Starting walstore-chunk without `--workspace-lease` is refused; it is not an alternative deployment mode. | | exit 1, ends with `workspace move requires an existing RF1 volume` | lifecycle store without a volume record | fix the cluster spec below | **2. The volume record comes from the cluster spec.** There is no command that