Files
seaweedfs/seaweed-block/cmd/blockvolume/durable_impl_default_test.go
T
pingqiuandClaude Opus 5.5 1f10755b0e blockvolume: walstore is the default for new volumes; smartwal is experimental
--durable-impl now defaults to empty (auto). A new volume is created as
walstore. An existing volume opens with the implementation its on-disk
superblock names, so volumes created under the old smartwal default keep
opening (no ImplKindMismatch on upgrade). An explicit selector keeps the
exact ErrImplKindMismatch refusal, and an unrecognized on-disk format is
still refused.

- core/frontend/durable: ImplAuto (the zero value) is resolved per volume
  in openOrCreate; openExisting/createFresh take the resolved
  implementation, and each volume handle records it, so DurableStatuses
  reports the on-disk implementation. ImplSmartWAL is documented as
  experimental; the 'production default' comments are removed.
- cmd/blockvolume: --durable-impl default '' with help text 'auto';
  smartwal (experimental). The walstore-only options still require an
  explicit --durable-impl=walstore.
- README: smartwal listed under 'Not claimed yet' with its open issues.

Tests: auto creates walstore; auto opens existing smartwal, walstore and
parallel-walstore volumes by their on-disk format; auto refuses an
unrecognized file; the flag default is empty; explicit values accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:31:27 -08:00

34 lines
1.1 KiB
Go

package main
import "testing"
// --durable-impl defaults to empty (auto): new volumes are walstore, and an
// existing volume opens with its on-disk format. smartwal is experimental
// and only used when chosen explicitly or found on disk.
func TestBlockvolumeDurableImplDefaultIsAuto(t *testing.T) {
f, err := parseFlags(phase150RequiredBlockvolumeArgs())
if err != nil {
t.Fatalf("parseFlags: %v", err)
}
if f.durableImpl != "" {
t.Fatalf("durableImpl default=%q, want empty (auto)", f.durableImpl)
}
}
func TestBlockvolumeDurableImplExplicitValues(t *testing.T) {
for _, impl := range []string{"walstore", "smartwal", "parallel-walstore"} {
args := append(phase150RequiredBlockvolumeArgs(), "--durable-root=/tmp/sw-block", "--durable-impl="+impl)
f, err := parseFlags(args)
if err != nil {
t.Fatalf("--durable-impl=%s: %v", impl, err)
}
if f.durableImpl != impl {
t.Fatalf("durableImpl=%q, want %q", f.durableImpl, impl)
}
}
args := append(phase150RequiredBlockvolumeArgs(), "--durable-impl=bogus")
if _, err := parseFlags(args); err == nil {
t.Fatal("--durable-impl=bogus accepted")
}
}