From 3166854cbecc867fdd3ec0b88561e4d9ec8e3dbe Mon Sep 17 00:00:00 2001 From: pingqiu Date: Fri, 20 Nov 2026 23:30:20 -0800 Subject: [PATCH] blockvolume: delete --chunk-dirty-threshold outright (pre-GA); a unit passing it fails at start Co-Authored-By: Claude Opus 5.5 --- seaweed-block/cmd/blockvolume/chunk_remote.go | 5 --- .../cmd/blockvolume/chunk_remote_test.go | 31 ++++++------------- seaweed-block/cmd/blockvolume/main.go | 10 +----- .../core/host/volume/chunk_control.go | 2 +- .../docs/design/agent-workspace-design.md | 2 +- seaweed-block/docs/standalone-deployment.md | 2 -- 6 files changed, 12 insertions(+), 40 deletions(-) diff --git a/seaweed-block/cmd/blockvolume/chunk_remote.go b/seaweed-block/cmd/blockvolume/chunk_remote.go index 1bc51d1c8d..f947f87823 100644 --- a/seaweed-block/cmd/blockvolume/chunk_remote.go +++ b/seaweed-block/cmd/blockvolume/chunk_remote.go @@ -31,10 +31,6 @@ const ( defaultChunkIntentTTL = time.Hour ) -// chunkDirtyThresholdRemoval is when --chunk-dirty-threshold, accepted and -// ignored since cuts stage by the COW budget (M5 Stage), is removed. -const chunkDirtyThresholdRemoval = "2027-01-31" - type chunkFlags struct { detachPrecopy bool hostLimit hostlimit.Config @@ -45,7 +41,6 @@ type chunkFlags struct { captureInterval time.Duration maintenanceInterval time.Duration automaticGC bool - dirtyThreshold int // deprecated, ignored (chunkDirtyThresholdRemoval) uploadConcurrency int hydrationWorkers int hydrationQueueDepth int diff --git a/seaweed-block/cmd/blockvolume/chunk_remote_test.go b/seaweed-block/cmd/blockvolume/chunk_remote_test.go index 51dd5615ae..b4083a1648 100644 --- a/seaweed-block/cmd/blockvolume/chunk_remote_test.go +++ b/seaweed-block/cmd/blockvolume/chunk_remote_test.go @@ -31,8 +31,8 @@ func TestWALStoreChunkFlags(t *testing.T) { if err != nil { t.Fatal(err) } - if d.chunk.captureInterval != 15*time.Minute || d.chunk.maintenanceInterval != time.Hour || d.chunk.automaticGC || len(d.warnings) != 0 { - t.Fatalf("scheduler defaults interval %s warnings %v, want capture 15m, maintenance 1h, GC off and no warning", d.chunk.captureInterval, d.warnings) + if d.chunk.captureInterval != 15*time.Minute || d.chunk.maintenanceInterval != time.Hour || d.chunk.automaticGC { + t.Fatalf("scheduler defaults interval %s, want capture 15m, maintenance 1h and GC off", d.chunk.captureInterval) } off, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-capture-interval=0")) @@ -122,25 +122,12 @@ func TestChunkHolderIsServerAndReplica(t *testing.T) { } } -// --chunk-dirty-threshold is deprecated (O-OPS-1): a cut stages by the -// copy-on-write budget (M5 Stage), so the flag never had an effect. It is -// still accepted, with any value and any durable implementation, and warns -// with its removal date; nothing reads its value. -func TestChunkDirtyThresholdIsDeprecatedAndIgnored(t *testing.T) { - base := func(extra ...string) []string { - return append(phase150RequiredBlockvolumeArgs(), extra...) - } - for _, args := range [][]string{ - base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-dirty-threshold=512"), - base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-dirty-threshold=-1"), - base("--durable-root=/tmp/sw-block", "--durable-impl=walstore", "--chunk-dirty-threshold=8"), - } { - f, err := parseFlags(args) - if err != nil { - t.Fatalf("%v: refused: %v", args, err) - } - if len(f.warnings) != 1 || !strings.Contains(f.warnings[0], "deprecated") || !strings.Contains(f.warnings[0], chunkDirtyThresholdRemoval) { - t.Fatalf("%v: warnings %v; want one deprecation warning naming %s", args, f.warnings, chunkDirtyThresholdRemoval) - } +// --chunk-dirty-threshold is gone (O-OPS-1): a cut stages by the +// 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") + 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) } } diff --git a/seaweed-block/cmd/blockvolume/main.go b/seaweed-block/cmd/blockvolume/main.go index 2fcf691f2c..14817c657f 100644 --- a/seaweed-block/cmd/blockvolume/main.go +++ b/seaweed-block/cmd/blockvolume/main.go @@ -42,7 +42,6 @@ import ( ) type flags struct { - warnings []string // printed at start (deprecated flags) cpuProfileDir string memoryLimitMiB int64 masterAddr string @@ -210,7 +209,6 @@ func parseFlags(args []string) (flags, error) { fs.IntVar(&f.chunk.uploadConcurrency, "chunk-upload-concurrency", 8, "walstore-chunk: maximum concurrent dirty-chunk uploads (1..64)") fs.IntVar(&f.chunk.hydrationWorkers, "chunk-hydration-workers", 2, "walstore-chunk: concurrent lazy chunk fetches per volume (1..64)") fs.IntVar(&f.chunk.hydrationQueueDepth, "chunk-hydration-queue-depth", 64, "walstore-chunk: distinct queued/in-flight hydration chunks per volume (1..65536)") - fs.IntVar(&f.chunk.dirtyThreshold, "chunk-dirty-threshold", 0, "deprecated and ignored: a cut stages by the copy-on-write budget, not a chunk count; removed after "+chunkDirtyThresholdRemoval) fs.BoolVar(&f.chunk.controlEndpoint, "chunk-control-endpoint", false, "walstore-chunk: expose the /chunk/* control routes (cut, snapshot, snapshots, snapshot/delete, detach) on the status HTTP listener; off by default; loopback-only like the listener") fs.UintVar(&f.durableBlocks, "durable-blocks", 2048, "number of blocks per volume on first create (ignored when opening existing)") fs.UintVar(&f.durableBlockSize, "durable-blocksize", 4096, "block size in bytes on first create") @@ -253,11 +251,8 @@ func parseFlags(args []string) (flags, error) { } memoryFlagSet := false fs.Visit(func(fl *flag.Flag) { - switch fl.Name { - case "memory-limit-mib": + if fl.Name == "memory-limit-mib" { memoryFlagSet = true - case "chunk-dirty-threshold": - f.warnings = append(f.warnings, "--chunk-dirty-threshold is deprecated and has no effect (a cut stages by the copy-on-write budget); it is removed after "+chunkDirtyThresholdRemoval) } }) if !memoryFlagSet && os.Getenv("GOMEMLIMIT") != "" { @@ -588,9 +583,6 @@ func durableCreateGeometry(f flags) (uint32, int, error) { } func run(f flags) int { - for _, w := range f.warnings { - fmt.Fprintln(os.Stderr, "blockvolume: warning:", w) - } // Diagnostics first: parseFlags validated the directory, and nothing // has been activated yet, so a failure here leaves nothing to clean up. stopProfile, err := startCPUProfileSignal(f.cpuProfileDir) diff --git a/seaweed-block/core/host/volume/chunk_control.go b/seaweed-block/core/host/volume/chunk_control.go index bc05328565..c95359db6e 100644 --- a/seaweed-block/core/host/volume/chunk_control.go +++ b/seaweed-block/core/host/volume/chunk_control.go @@ -93,7 +93,7 @@ type ChunkCutStatsBody struct { StagedChunks int `json:"stagedChunks"` StagedChunksUsed int `json:"stagedChunksUsed"` BarrierCopyChunks int `json:"barrierCopyChunks"` - BarrierOverBound bool `json:"barrierOverBound"` // always false in production (legacy fixture bound only); deprecated with --chunk-dirty-threshold + BarrierOverBound bool `json:"barrierOverBound"` // always false in production (legacy fixture bound only); goes with the status schema (O-OPS-2) } func cutStatsBody(s storage.ChunkCutStats) ChunkCutStatsBody { diff --git a/seaweed-block/docs/design/agent-workspace-design.md b/seaweed-block/docs/design/agent-workspace-design.md index 6aabd7faef..3cdd1a326b 100644 --- a/seaweed-block/docs/design/agent-workspace-design.md +++ b/seaweed-block/docs/design/agent-workspace-design.md @@ -122,7 +122,7 @@ Per volume, under the chunk base directory in the filer (`core/frontend/chunksto `chunkLayerImpl.captureLocked` (`core/storage/chunk_layer.go`; contract in the `chunk_seam.go` header). A checkpoint is not a prefix image (the extent can already hold blocks newer than the checkpoint), so a cut is a quiesced point, not a checkpoint boundary. 1. **Admit:** refuse when closed, fenced, detached, during a base install, or when `CaptureAllowed` fails (healthy primary, unchanged lineage, valid lease). -2. **Pre-copy:** while the chunks that would be copied under the barrier exceed half the copy-on-write side budget, stage the hottest of them per round outside the barrier, repeating only while the remainder shrinks (`stage`). The deprecated `--chunk-dirty-threshold` has no effect here. A staged chunk with new bytes is uploaded under a fresh key named by an intent written first. +2. **Pre-copy:** while the chunks that would be copied under the barrier exceed half the copy-on-write side budget, stage the hottest of them per round outside the barrier, repeating only while the remainder shrinks (`stage`). A staged chunk with new bytes is uploaded under a fresh key named by an intent written first. 3. **Quiesce:** take the capture barrier (walstore `captureMu`) exclusively, then `Sync`. H is the synced LSN; no data newer than H exists in the WAL or the extent. 4. **Open and copy:** install the fixed candidate window under the barrier, then release it. Bounded workers copy through the validated reader outside the barrier. A first writer saves a pending candidate before mutation; a writer waits only for its own copying/saving chunk. A staged copy is reused only if its version and HEAD still match. Pause is Sync plus candidate/window installation, independent of copy bytes. 5. **LSN guard:** if H is below HEAD's `RemoteLSN`, refuse (`lsn_behind`). diff --git a/seaweed-block/docs/standalone-deployment.md b/seaweed-block/docs/standalone-deployment.md index 75fea226a2..1e1f3e1d4f 100644 --- a/seaweed-block/docs/standalone-deployment.md +++ b/seaweed-block/docs/standalone-deployment.md @@ -128,8 +128,6 @@ the example units, which turn them into flags. blockvolume itself reads only | `SWB_WORKSPACE_LEASE` | `--workspace-lease` | `false` | Require a master lease; fail closed without one | | `SWB_VOLUME_EXTRA_ARGS` | any | empty | Other flags (Kubernetes gate and source-gated flags) | -`--chunk-dirty-threshold` (and `SWB_CHUNK_DIRTY_THRESHOLD`) is deprecated and ignored: a cut stages by its copy-on-write budget, not a chunk count. It is still accepted with a startup warning, and it is removed after 2027-01-31. With it, the `barrierOverBound` field of a cut's result is always `false` in production; it goes with the flag. - The `--chunk-*` and `--workspace-lease` flags are refused unless `--durable-impl=walstore-chunk`; leave them at their defaults otherwise.