From 11227d158a815297e51d44a4c31f2f294515ae14 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Fri, 20 Nov 2026 16:23:50 -0800 Subject: [PATCH] feat: advertise plain chunk detach capability --- seaweed-block/cmd/blockvolume/main.go | 1 + .../plain_detach_capability_test.go | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 seaweed-block/cmd/blockvolume/plain_detach_capability_test.go diff --git a/seaweed-block/cmd/blockvolume/main.go b/seaweed-block/cmd/blockvolume/main.go index de5e5739cf..ca2a80a683 100644 --- a/seaweed-block/cmd/blockvolume/main.go +++ b/seaweed-block/cmd/blockvolume/main.go @@ -201,6 +201,7 @@ func parseFlags(args []string) (flags, error) { fs.StringVar(&f.chunk.path, "chunk-path", defaultChunkPath, "walstore-chunk: filer directory holding one directory per volume (HEAD and chunk key bindings)") fs.StringVar(&f.chunk.collection, "chunk-collection", "", "walstore-chunk: collection for chunk needles (empty = filer default / storage rule)") fs.StringVar(&f.chunk.replication, "chunk-replication", "", "walstore-chunk: replication for chunk needles (empty = filer default / storage rule)") + fs.Bool("chunk-detach-plain-supported", false, "capability: supports idle plain=true on /chunk/detach (no-op flag)") fs.BoolVar(&f.chunk.detachPrecopy, "chunk-detach-precopy", false, "walstore-chunk: converge rolling cuts before final detach; refuse cutover if measured tail does not fit") fs.DurationVar(&f.chunk.captureInterval, "chunk-capture-interval", defaultChunkCaptureInterval, "walstore-chunk: automatic cut once this long has passed since the last successful cut; 0 (default) disables the timer, e.g. 15m as a host-loss safety net") fs.IntVar(&f.chunk.uploadConcurrency, "chunk-upload-concurrency", 8, "walstore-chunk: maximum concurrent dirty-chunk uploads (1..64)") diff --git a/seaweed-block/cmd/blockvolume/plain_detach_capability_test.go b/seaweed-block/cmd/blockvolume/plain_detach_capability_test.go new file mode 100644 index 0000000000..e49fb06fb7 --- /dev/null +++ b/seaweed-block/cmd/blockvolume/plain_detach_capability_test.go @@ -0,0 +1,23 @@ +package main + +import ( + "reflect" + "testing" +) + +func TestPlainDetachCapabilityFlagIsNoop(t *testing.T) { + base := []string{"--master", "127.0.0.1:1", "--server-id", "h1", "--volume-id", "v1", "--replica-id", "r1", "--data-addr", "127.0.0.1:2", "--ctrl-addr", "127.0.0.1:3"} + want, err := parseFlags(base) + if err != nil { + t.Fatal(err) + } + for _, arg := range []string{"--chunk-detach-plain-supported", "--chunk-detach-plain-supported=true", "--chunk-detach-plain-supported=false"} { + got, err := parseFlags(append(append([]string{}, base...), arg)) + if err != nil { + t.Fatalf("capability flag unavailable: %s: %v", arg, err) + } + if !reflect.DeepEqual(got, want) { + t.Fatalf("capability flag changed runtime configuration: %s", arg) + } + } +}