From a81bca49264c1ef332eaa467a7d176d8fcc70bdf Mon Sep 17 00:00:00 2001 From: pingqiu Date: Wed, 18 Nov 2026 03:08:30 -0800 Subject: [PATCH] feat(storage): activate mapped v3 through the production storage callers --- seaweed-block/.github/workflows/test.yml | 5 +- .../durable_startup_slotcrc_test.go | 96 +- .../v2legacy/real_store_legacy_test.go | 103 + .../internal/v2legacy/v2legacy_test.go | 94 - seaweed-block/cmd/sw-block/migrate_test.go | 10 +- .../core/frontend/chunkstore/catalog_test.go | 4 +- .../chunk_remote_integration_test.go | 2 +- .../frontend/chunkstore/chunk_remote_test.go | 2 +- .../core/frontend/chunkstore/gc_test.go | 2 +- .../core/frontend/chunkstore/manifest_test.go | 4 +- .../core/frontend/durable/provider.go | 9 +- .../durable/provider_auto_impl_test.go | 36 + .../durable/provider_chunk_lifetime_test.go | 65 +- .../durable/provider_format_v3_test.go | 13 +- .../durable/provider_seed_linux_test.go | 3 +- .../core/frontend/durable/provider_test.go | 4 +- .../component/apply_gate_scenarios_test.go | 6 +- .../replication/component/cluster_test.go | 2 +- .../component/format_v3_fixture_test.go | 24 + .../component/frontier_regression_test.go | 2 +- .../component/stale_entry_adversarial_test.go | 1 + .../component/t4d3_scenarios_test.go | 1 + .../storage/activation_recycle_v3_test.go | 67 + seaweed-block/core/storage/block_metadata.go | 10 +- .../core/storage/block_metadata_test.go | 38 +- .../core/storage/chunk_fake_remote_test.go | 68 +- .../core/storage/chunk_frontier_test.go | 6 +- .../core/storage/chunk_layer_c11_test.go | 31 +- .../core/storage/chunk_layer_contract_test.go | 46 +- .../core/storage/chunk_layer_detach_test.go | 6 +- .../storage/chunk_layer_fresh_bitmap_test.go | 2 +- .../storage/chunk_layer_lsn_order_test.go | 2 +- .../core/storage/chunk_layer_precopy_test.go | 27 +- .../core/storage/chunk_layer_races_test.go | 18 +- .../storage/chunk_layer_reconcile_test.go | 8 +- .../core/storage/chunk_layer_stats_test.go | 8 +- .../storage/chunk_layer_typed_cause_test.go | 8 +- .../core/storage/chunk_restore_test.go | 2 +- .../storage/chunk_upload_parallel_test.go | 3 +- seaweed-block/core/storage/contract_test.go | 47 +- .../storage/flusher_instrumentation_test.go | 6 +- .../core/storage/flusher_snapshot_cut_test.go | 4 +- seaweed-block/core/storage/flusher_test.go | 30 +- .../core/storage/format_v3_test_support.go | 9 + .../storage/legacy_fixture_isolation_test.go | 75 + .../core/storage/legacy_fixture_test.go | 14 + seaweed-block/core/storage/superblock.go | 11 +- seaweed-block/core/storage/superblock_v3.go | 5 +- .../core/storage/volume_lock_v3_test.go | 6 +- seaweed-block/core/storage/wal_entry_v3.go | 17 + seaweed-block/core/storage/wal_io_v3.go | 23 +- seaweed-block/core/storage/walstore.go | 29 +- .../core/storage/walstore_activation_test.go | 158 ++ .../storage/walstore_batch_lsn_reuse_test.go | 4 +- .../core/storage/walstore_batch_v3_test.go | 2 +- .../walstore_checkpoint_crash_linux_test.go | 4 +- .../walstore_checkpoint_safety_test.go | 32 +- .../storage/walstore_format_admission_test.go | 6 +- .../core/storage/walstore_legacy_trim_test.go | 6 +- .../storage/walstore_midhistory_hole_test.go | 6 +- .../walstore_multiblock_profile_test.go | 2 +- .../core/storage/walstore_multiblock_test.go | 20 +- .../storage/walstore_persisted_tail_test.go | 22 +- .../core/storage/walstore_readonly.go | 4 + .../core/storage/walstore_readonly_v3.go | 15 +- .../core/storage/walstore_readonly_v3_test.go | 8 +- .../core/storage/walstore_recovery.go | 2 +- .../walstore_recovery_frontier_gap_test.go | 4 +- .../walstore_recovery_hardening_test.go | 12 +- .../storage/walstore_recovery_lww_test.go | 4 +- .../core/storage/walstore_retention_test.go | 2 +- .../storage/walstore_sticky_fsync_test.go | 4 +- .../core/storage/walstore_sticky_race_test.go | 2 +- .../walstore_sync_frontier_order_test.go | 2 +- .../storage/walstore_sync_generation_test.go | 24 +- seaweed-block/core/storage/walstore_test.go | 10 +- seaweed-block/core/storage/walstore_v3.go | 131 +- seaweed-block/docs/design/block-design.md | 16 + .../format-v3-legacy-test-inventory.json | 1838 +++++++++++++++++ .../design/format-v3-legacy-test-inventory.md | 140 ++ seaweed-block/docs/design/invariants.md | 19 +- seaweed-block/docs/spec/README.md | 6 + 82 files changed, 3203 insertions(+), 416 deletions(-) create mode 100644 seaweed-block/cmd/sw-block/internal/v2legacy/real_store_legacy_test.go create mode 100644 seaweed-block/core/replication/component/format_v3_fixture_test.go create mode 100644 seaweed-block/core/storage/activation_recycle_v3_test.go create mode 100644 seaweed-block/core/storage/legacy_fixture_isolation_test.go create mode 100644 seaweed-block/core/storage/legacy_fixture_test.go create mode 100644 seaweed-block/core/storage/walstore_activation_test.go create mode 100644 seaweed-block/docs/design/format-v3-legacy-test-inventory.json create mode 100644 seaweed-block/docs/design/format-v3-legacy-test-inventory.md diff --git a/seaweed-block/.github/workflows/test.yml b/seaweed-block/.github/workflows/test.yml index d936cb7be4..b913b30bb2 100644 --- a/seaweed-block/.github/workflows/test.yml +++ b/seaweed-block/.github/workflows/test.yml @@ -47,4 +47,7 @@ jobs: run: go vet ./... - name: Test - run: go test -short -count=1 -timeout 10m ./... + # Legacy-input fixtures and native caller controls stay executable after + # their constructors move behind the explicit test-only build tag. + # Bound package concurrency for existing short wall-clock assertions. + run: go test -p=1 -short -tags=swblock_format_v3_test -count=1 -timeout 10m ./... diff --git a/seaweed-block/cmd/blockvolume/durable_startup_slotcrc_test.go b/seaweed-block/cmd/blockvolume/durable_startup_slotcrc_test.go index e355245935..bf0e7a71f7 100644 --- a/seaweed-block/cmd/blockvolume/durable_startup_slotcrc_test.go +++ b/seaweed-block/cmd/blockvolume/durable_startup_slotcrc_test.go @@ -1,7 +1,9 @@ package main import ( + "context" "os" + "os/exec" "path/filepath" "strings" "testing" @@ -148,60 +150,54 @@ func TestDurableStartup_Issue51_SmartWALTornTailRecovers(t *testing.T) { } } -// walstore interim: the same mid-history -// corruption on a walstore volume does not become an outage: startup is -// ready, and the durable status carries the typed warning. -func TestDurableStartup_Issue51_WALStoreHoleIsAWarningNotAnOutage(t *testing.T) { - root := t.TempDir() - cfg := durable.ProviderConfig{Impl: durable.ImplWALStore, StorageRoot: root, BlockSize: 4096, NumBlocks: 16} - path := filepath.Join(root, "v1.bin") - // A crashed walstore: entries synced, nothing checkpointed (the file - // as it is right after Sync; a clean close would checkpoint). - s, err := storage.CreateWALStore(path, 16, 4096) - if err != nil { - t.Fatal(err) - } - s.DisableAutoFlushForRecoveryTest() - for i := uint32(0); i < 4; i++ { - data := make([]byte, 4096) - data[0] = byte(0xD0 + i) - if _, err := s.Write(i, data); err != nil { +// V3 replaces the legacy warning-only recovery policy with nonce-bound, +// contiguous WAL recovery. Corruption below strict W must block readiness. +// The old v2 warning control is retained in walstore_midhistory_hole_test.go. +func TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness(t *testing.T) { + const childEnv = "SWBLOCK_V3_STARTUP_CRASH_PATH" + if path := os.Getenv(childEnv); path != "" { + s, err := storage.CreateWALStoreWithOptions(path, 16, 4096, storage.WALStoreOptions{WMode: storage.WModeStrict}) + if err != nil { t.Fatal(err) } - } - if _, err := s.Sync(); err != nil { - t.Fatal(err) - } - crashed, err := os.ReadFile(path) - if err != nil { - t.Fatal(err) - } - _ = s.Close() - // Corrupt a payload byte of the second entry (walstore's WAL starts at - // 4096; a one-block entry is 38+4096 bytes). - crashed[4096+(38+4096)+38+100] ^= 0xFF - if err := os.WriteFile(path, crashed, 0o644); err != nil { - t.Fatal(err) - } - dp, err := durable.NewDurableProvider(cfg, healthyView{}) - if err != nil { - t.Fatal(err) - } - defer dp.Close() - h := &spyHost{} - outcome, evidence, err := openAndRecoverDurable(dp, h, "v1", 5*time.Second) - if outcome != durableStartupReady || len(h.reported) != 0 { - t.Fatalf("walstore hole: outcome=%v reported=%v evidence=%q err=%v; want ready (no outage)", outcome, h.reported, evidence, err) - } - warned := false - for _, st := range dp.DurableStatuses() { - for _, w := range st.Warnings { - if strings.HasPrefix(w, storage.WarningWALHoleSuspected+":") { - warned = st.HolesSuspected == 1 + s.DisableAutoFlushForRecoveryTest() + for i := uint32(0); i < 4; i++ { + data := make([]byte, 4096) + data[0] = byte(0xd0 + i) + if _, err := s.Write(i, data); err != nil { + t.Fatal(err) } } + if _, err := s.Sync(); err != nil { + t.Fatal(err) + } + os.Exit(0) // deliberately no Close/checkpoint; OS releases the owner lock } - if !warned { - t.Fatalf("durable statuses %+v; want the %s warning, counted once", dp.DurableStatuses(), storage.WarningWALHoleSuspected) + root := t.TempDir() + path := filepath.Join(root, "v1.bin") + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + cmd := exec.CommandContext(ctx, os.Args[0], "-test.run=^TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness$") + cmd.Env = append(os.Environ(), childEnv+"="+path) + if out, err := cmd.CombinedOutput(); err != nil { + t.Fatalf("crash fixture: %v\n%s", err, out) + } + f, err := os.OpenFile(path, os.O_RDWR, 0) + if err != nil { + t.Fatal(err) + } + at := int64(8192 + (70 + 4096) + 62 + 100) // v3 second record payload + b := make([]byte, 1) + _, re := f.ReadAt(b, at) + b[0] ^= 0xff + _, we := f.WriteAt(b, at) + ce := f.Close() + if re != nil || we != nil || ce != nil { + t.Fatal(re, we, ce) + } + cfg := durable.ProviderConfig{Impl: durable.ImplWALStore, StorageRoot: root, BlockSize: 4096, NumBlocks: 16} + outcome, h := startAfterCorruption(t, cfg) + if outcome != durableStartupFaulted || len(h.reported) != 1 || h.reported[0] != volume.UnhealthyWALCorrupt || len(h.blocked) == 0 { + t.Fatalf("committed hole: outcome=%v reported=%v blocked=%v; want wal_corrupt and blocked", outcome, h.reported, h.blocked) } } diff --git a/seaweed-block/cmd/sw-block/internal/v2legacy/real_store_legacy_test.go b/seaweed-block/cmd/sw-block/internal/v2legacy/real_store_legacy_test.go new file mode 100644 index 0000000000..b5f4388b8f --- /dev/null +++ b/seaweed-block/cmd/sw-block/internal/v2legacy/real_store_legacy_test.go @@ -0,0 +1,103 @@ +//go:build swblock_format_v3_test + +package v2legacy + +import ( + "encoding/binary" + "errors" + "github.com/seaweedfs/seaweed-block/core/storage" + "os" + "path/filepath" + "testing" +) + +// TODO(format-v3 row 14a): retain raw-codec controls in the default suite; +// these real v2-engine fixtures remain explicit in the tagged migration suite. +func TestReadSuperblockRefusesOtherFormats(t *testing.T) { + path := filepath.Join(t.TempDir(), "v2") + s, err := storage.CreateLegacyWALStoreTest(path, 16, 4096) + if err != nil { + t.Fatal(err) + } + if err := s.Close(); err != nil { + t.Fatal(err) + } + raw, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + sb, err := ReadSuperblock(raw[:SuperblockSize]) + if err != nil || sb.WALOffset != SuperblockSize || sb.BlockSize != 4096 { + t.Fatalf("real v2 superblock: %+v, %v", sb, err) + } + impl2 := append([]byte(nil), raw[:SuperblockSize]...) + binary.LittleEndian.PutUint32(impl2[92:], 2) + if _, err := ReadSuperblock(impl2); !errors.Is(err, ErrImplUnsupported) { + t.Fatalf("impl version 2: err = %v, want ErrImplUnsupported", err) + } + v3 := append([]byte(nil), raw[:SuperblockSize]...) + binary.LittleEndian.PutUint16(v3[4:], 3) + if _, err := ReadSuperblock(v3); !errors.Is(err, ErrNotV2) { + t.Fatalf("version 3: err = %v, want ErrNotV2", err) + } +} + +// Real v2 stores: a cleanly closed, flushed store scans clean; a store with +// synced records that were never flushed (a crash) refuses, even though +// its superblock may say head = tail (the #156 shape: bounds not persisted +// by an ordinary Sync). +func TestScanCleanOnRealV2Stores(t *testing.T) { + scan := func(t *testing.T, path string) []Finding { + raw, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + sb, err := ReadSuperblock(raw[:SuperblockSize]) + if err != nil { + t.Fatal(err) + } + return ScanClean(raw[SuperblockSize:SuperblockSize+sb.WALSize], sb.WALCheckpointLSN) + } + blk := make([]byte, 4096) + t.Run("cleanly closed", func(t *testing.T) { + path := filepath.Join(t.TempDir(), "clean") + s, err := storage.CreateLegacyWALStoreTest(path, 16, 4096) + if err != nil { + t.Fatal(err) + } + for lba := uint32(0); lba < 4; lba++ { + if _, err := s.Write(lba, blk); err != nil { + t.Fatal(err) + } + } + if _, err := s.Sync(); err != nil { + t.Fatal(err) + } + if err := s.Close(); err != nil { + t.Fatal(err) + } + if f := scan(t, path); len(f) != 0 { + t.Fatalf("a cleanly closed v2 store refused: %+v", f[0]) + } + }) + t.Run("synced, never flushed", func(t *testing.T) { + path := filepath.Join(t.TempDir(), "dirty") + s, err := storage.CreateLegacyWALStoreTest(path, 16, 4096) + if err != nil { + t.Fatal(err) + } + s.DisableAutoFlushForRecoveryTest() + for lba := uint32(0); lba < 2; lba++ { + if _, err := s.Write(lba, blk); err != nil { + t.Fatal(err) + } + } + if _, err := s.Sync(); err != nil { + t.Fatal(err) + } + if f := scan(t, path); len(f) == 0 { + t.Fatal("synced unflushed v2 records scanned clean") + } + _ = s.Close() + }) +} diff --git a/seaweed-block/cmd/sw-block/internal/v2legacy/v2legacy_test.go b/seaweed-block/cmd/sw-block/internal/v2legacy/v2legacy_test.go index 906ed59f2d..fd7871d803 100644 --- a/seaweed-block/cmd/sw-block/internal/v2legacy/v2legacy_test.go +++ b/seaweed-block/cmd/sw-block/internal/v2legacy/v2legacy_test.go @@ -2,13 +2,8 @@ package v2legacy import ( "encoding/binary" - "errors" "hash/crc32" - "os" - "path/filepath" "testing" - - "github.com/seaweedfs/seaweed-block/core/storage" ) // Plan row 13a controls (DESIGN r17.4 section 10.1 precondition 3; owner @@ -72,92 +67,3 @@ func TestScanCleanFindsEveryUnflushedV2RecordShape(t *testing.T) { }) } } - -func TestReadSuperblockRefusesOtherFormats(t *testing.T) { - path := filepath.Join(t.TempDir(), "v2") - s, err := storage.CreateWALStore(path, 16, 4096) - if err != nil { - t.Fatal(err) - } - if err := s.Close(); err != nil { - t.Fatal(err) - } - raw, err := os.ReadFile(path) - if err != nil { - t.Fatal(err) - } - sb, err := ReadSuperblock(raw[:SuperblockSize]) - if err != nil || sb.WALOffset != SuperblockSize || sb.BlockSize != 4096 { - t.Fatalf("real v2 superblock: %+v, %v", sb, err) - } - impl2 := append([]byte(nil), raw[:SuperblockSize]...) - binary.LittleEndian.PutUint32(impl2[92:], 2) - if _, err := ReadSuperblock(impl2); !errors.Is(err, ErrImplUnsupported) { - t.Fatalf("impl version 2: err = %v, want ErrImplUnsupported", err) - } - v3 := append([]byte(nil), raw[:SuperblockSize]...) - binary.LittleEndian.PutUint16(v3[4:], 3) - if _, err := ReadSuperblock(v3); !errors.Is(err, ErrNotV2) { - t.Fatalf("version 3: err = %v, want ErrNotV2", err) - } -} - -// Real v2 stores: a cleanly closed, flushed store scans clean; a store with -// synced records that were never flushed (a crash) refuses, even though -// its superblock may say head = tail (the #156 shape: bounds not persisted -// by an ordinary Sync). -func TestScanCleanOnRealV2Stores(t *testing.T) { - scan := func(t *testing.T, path string) []Finding { - raw, err := os.ReadFile(path) - if err != nil { - t.Fatal(err) - } - sb, err := ReadSuperblock(raw[:SuperblockSize]) - if err != nil { - t.Fatal(err) - } - return ScanClean(raw[SuperblockSize:SuperblockSize+sb.WALSize], sb.WALCheckpointLSN) - } - blk := make([]byte, 4096) - t.Run("cleanly closed", func(t *testing.T) { - path := filepath.Join(t.TempDir(), "clean") - s, err := storage.CreateWALStore(path, 16, 4096) - if err != nil { - t.Fatal(err) - } - for lba := uint32(0); lba < 4; lba++ { - if _, err := s.Write(lba, blk); err != nil { - t.Fatal(err) - } - } - if _, err := s.Sync(); err != nil { - t.Fatal(err) - } - if err := s.Close(); err != nil { - t.Fatal(err) - } - if f := scan(t, path); len(f) != 0 { - t.Fatalf("a cleanly closed v2 store refused: %+v", f[0]) - } - }) - t.Run("synced, never flushed", func(t *testing.T) { - path := filepath.Join(t.TempDir(), "dirty") - s, err := storage.CreateWALStore(path, 16, 4096) - if err != nil { - t.Fatal(err) - } - s.DisableAutoFlushForRecoveryTest() - for lba := uint32(0); lba < 2; lba++ { - if _, err := s.Write(lba, blk); err != nil { - t.Fatal(err) - } - } - if _, err := s.Sync(); err != nil { - t.Fatal(err) - } - if f := scan(t, path); len(f) == 0 { - t.Fatal("synced unflushed v2 records scanned clean") - } - _ = s.Close() - }) -} diff --git a/seaweed-block/cmd/sw-block/migrate_test.go b/seaweed-block/cmd/sw-block/migrate_test.go index e7b2ef3bfd..fd8386c5e1 100644 --- a/seaweed-block/cmd/sw-block/migrate_test.go +++ b/seaweed-block/cmd/sw-block/migrate_test.go @@ -1,3 +1,5 @@ +//go:build swblock_format_v3_test + package main import ( @@ -24,7 +26,7 @@ func migBlk(b byte) []byte { return bytes.Repeat([]byte{b}, migBlock) } func v2Volume(t *testing.T, clean bool) string { t.Helper() path := filepath.Join(t.TempDir(), "vol") - s, err := storage.CreateWALStore(path, 64, migBlock) + s, err := storage.CreateLegacyWALStoreTest(path, 64, migBlock) if err != nil { t.Fatal(err) } @@ -126,7 +128,7 @@ func TestMigrateV3CleanVolume(t *testing.T) { if _, err := os.Stat(path + ".v2-chunkbitmap.bak"); err != nil { t.Fatalf("retired bitmap: %v", err) } - if s, err := storage.OpenWALStore(path); err == nil { + if s, err := storage.OpenLegacyWALStoreTest(path); err == nil { _ = s.Close() t.Fatal("the old binary opened a migrated volume") } @@ -245,7 +247,7 @@ func TestMigrateV3OldBinaryAfterPreparation(t *testing.T) { } migrate(t, path) migrateStepHook = nil - s, err := storage.OpenWALStore(path) + s, err := storage.OpenLegacyWALStoreTest(path) if err != nil { t.Fatalf("the old binary refused a prepared-only volume: %v", err) } @@ -268,7 +270,7 @@ func TestMigrateV3OldBinaryAfterPreparation(t *testing.T) { t.Fatal("the rerun migrated a volume the old binary left unflushed") } // The operator remedy: open with the old binary, flush, close cleanly. - s2, err := storage.OpenWALStore(path) + s2, err := storage.OpenLegacyWALStoreTest(path) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/frontend/chunkstore/catalog_test.go b/seaweed-block/core/frontend/chunkstore/catalog_test.go index 533b82f2ba..ae795e52dd 100644 --- a/seaweed-block/core/frontend/chunkstore/catalog_test.go +++ b/seaweed-block/core/frontend/chunkstore/catalog_test.go @@ -403,7 +403,7 @@ func TestFork_ThenFreshHostReadsSnapshotImage(t *testing.T) { t.Fatal(err) } p := filepath.Join(dir, vol) - s, err := storage.CreateWALStore(p, blocks, 4096) + s, err := storage.CreateWALStoreWithOptions(p, blocks, 4096, storage.WALStoreOptions{ChunkBlocks: chunkBlocks}) if err != nil { t.Fatal(err) } @@ -577,7 +577,7 @@ func TestDetach_ProductionSerializedHead(t *testing.T) { ctx := context.Background() f, b := newFakeFiler(), newFakeBlobs() p := filepath.Join(t.TempDir(), "v1") - s, err := storage.CreateWALStore(p, 64, 4096) + s, err := storage.CreateWALStoreWithOptions(p, 64, 4096, storage.WALStoreOptions{ChunkBlocks: 8}) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/frontend/chunkstore/chunk_remote_integration_test.go b/seaweed-block/core/frontend/chunkstore/chunk_remote_integration_test.go index 5115efb612..733cb48492 100644 --- a/seaweed-block/core/frontend/chunkstore/chunk_remote_integration_test.go +++ b/seaweed-block/core/frontend/chunkstore/chunk_remote_integration_test.go @@ -219,7 +219,7 @@ func TestIntegration_ChunkLayerCaptureThenFreshHost(t *testing.T) { dir := t.TempDir() attach := func(name string, fresh bool) (*storage.WALStore, storage.ChunkLayer) { p := filepath.Join(dir, name) - s, err := storage.CreateWALStore(p, blocks, 4096) + s, err := storage.CreateWALStoreWithOptions(p, blocks, 4096, storage.WALStoreOptions{ChunkBlocks: chunkBlocks}) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/frontend/chunkstore/chunk_remote_test.go b/seaweed-block/core/frontend/chunkstore/chunk_remote_test.go index 5e545e0a0a..1fe41eee8e 100644 --- a/seaweed-block/core/frontend/chunkstore/chunk_remote_test.go +++ b/seaweed-block/core/frontend/chunkstore/chunk_remote_test.go @@ -252,7 +252,7 @@ func TestChunkRemote_ChunkLayerCaptureThenFreshHost(t *testing.T) { attach := func(name string, fresh bool) (*storage.WALStore, storage.ChunkLayer) { p := filepath.Join(dir, name) - s, err := storage.CreateWALStore(p, blocks, 4096) + s, err := storage.CreateWALStoreWithOptions(p, blocks, 4096, storage.WALStoreOptions{ChunkBlocks: chunkBlocks}) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/frontend/chunkstore/gc_test.go b/seaweed-block/core/frontend/chunkstore/gc_test.go index 6ba7eca47b..dc544a034a 100644 --- a/seaweed-block/core/frontend/chunkstore/gc_test.go +++ b/seaweed-block/core/frontend/chunkstore/gc_test.go @@ -69,7 +69,7 @@ func TestGC_StalledCutRemainsReadableAfterTwoMarks(t *testing.T) { } held := &heldGCRemote{remote, make(chan struct{}), make(chan struct{})} p := filepath.Join(t.TempDir(), "volume") - s, e := storage.CreateWALStore(p, 64, 4096) + s, e := storage.CreateWALStoreWithOptions(p, 64, 4096, storage.WALStoreOptions{ChunkBlocks: 8}) if e != nil { t.Fatal(e) } diff --git a/seaweed-block/core/frontend/chunkstore/manifest_test.go b/seaweed-block/core/frontend/chunkstore/manifest_test.go index 58d39ea59c..6b8855ade1 100644 --- a/seaweed-block/core/frontend/chunkstore/manifest_test.go +++ b/seaweed-block/core/frontend/chunkstore/manifest_test.go @@ -23,7 +23,7 @@ func TestManifest_CapturePublishesSegmentRoot(t *testing.T) { t.Fatal(err) } p := filepath.Join(t.TempDir(), "volume") - s, err := storage.CreateWALStore(p, 64, 4096) + s, err := storage.CreateWALStoreWithOptions(p, 64, 4096, storage.WALStoreOptions{ChunkBlocks: 8}) if err != nil { t.Fatal(err) } @@ -281,7 +281,7 @@ func TestManifest_NoopFlatUpgradeUsesOneNormalGeneration(t *testing.T) { t.Fatal(err) } p := filepath.Join(t.TempDir(), "store") - s, err := storage.CreateWALStore(p, 64, 4096) + s, err := storage.CreateWALStoreWithOptions(p, 64, 4096, storage.WALStoreOptions{ChunkBlocks: 8}) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/frontend/durable/provider.go b/seaweed-block/core/frontend/durable/provider.go index 36996d0965..1b9f8e565f 100644 --- a/seaweed-block/core/frontend/durable/provider.go +++ b/seaweed-block/core/frontend/durable/provider.go @@ -636,6 +636,8 @@ func (p *DurableProvider) verifyImplOnDisk(path string) (ImplName, error) { // the format's real header selector instead of rejecting on byte 0. if err := parallelwal.ProbeStore(path); err == nil { diskImpl, ok = ImplParallelWALStore, true + } else if err := storage.ProbeWALStoreV3(path); err == nil { + diskImpl, ok = ImplWALStore, true } } if !ok { @@ -738,7 +740,7 @@ func (p *DurableProvider) createFresh(volumeID, path string, impl ImplName) (*vo if p.testWALStoreFactory != nil { ws, err = p.testWALStoreFactory(path, true) } else { - ws, err = storage.CreateWALStore(path, p.cfg.NumBlocks, p.cfg.BlockSize) + ws, err = storage.CreateWALStoreWithOptions(path, p.cfg.NumBlocks, p.cfg.BlockSize, storage.WALStoreOptions{ChunkBlocks: p.cfg.ChunkBlocks}) } if err != nil { return nil, fmt.Errorf("durable: CreateWALStore %s: %w", path, err) @@ -918,6 +920,11 @@ func chunkSidecars(path string) ([]string, error) { } var out []string for _, e := range entries { + // The owned v3 LSN map belongs to plain walstore as well. Remote + // chunk identity still has its own presence/fresh/HEAD sidecars. + if e.Name() == base+".chunkmap" { + continue + } if !e.IsDir() && strings.HasPrefix(e.Name(), base+".chunk") { out = append(out, e.Name()) } diff --git a/seaweed-block/core/frontend/durable/provider_auto_impl_test.go b/seaweed-block/core/frontend/durable/provider_auto_impl_test.go index 229997d61f..0d60aa8a75 100644 --- a/seaweed-block/core/frontend/durable/provider_auto_impl_test.go +++ b/seaweed-block/core/frontend/durable/provider_auto_impl_test.go @@ -1,6 +1,7 @@ package durable_test import ( + "bytes" "context" "errors" "io" @@ -75,6 +76,41 @@ func TestDurableProvider_AutoCreatesWALStore(t *testing.T) { } } +func TestDurableProvider_AutoOpensV3FallbackSlot(t *testing.T) { + root := t.TempDir() + p := autoProvider(t, root, durable.ImplWALStore) + s, err := p.EnsureStorage("v1") + if err != nil { + t.Fatal(err) + } + if _, err := s.Write(3, bytes.Repeat([]byte{0x73}, 4096)); err != nil { + t.Fatal(err) + } + if _, err := s.Sync(); err != nil { + t.Fatal(err) + } + if err := p.Close(); err != nil { + t.Fatal(err) + } + path := filepath.Join(root, "v1.bin") + f, err := os.OpenFile(path, os.O_RDWR, 0) + if err != nil { + t.Fatal(err) + } + _, err = f.WriteAt([]byte{0xff}, 0) + ce := f.Close() + if err != nil || ce != nil { + t.Fatal(err, ce) + } + auto := autoProvider(t, root, durable.ImplAuto) + if _, err := auto.EnsureStorage("v1"); err != nil { + t.Fatalf("valid v3 fallback must pass the auto probe: %v", err) + } + if _, err := auto.RecoverVolume(context.Background(), "v1"); err != nil { + t.Fatal(err) + } +} + func TestDurableProvider_AutoOpensExistingVolumeByOnDiskFormat(t *testing.T) { for _, impl := range []durable.ImplName{durable.ImplSmartWAL, durable.ImplWALStore, durable.ImplParallelWALStore} { t.Run(string(impl), func(t *testing.T) { diff --git a/seaweed-block/core/frontend/durable/provider_chunk_lifetime_test.go b/seaweed-block/core/frontend/durable/provider_chunk_lifetime_test.go index 4cc8a19612..2311dd7a98 100644 --- a/seaweed-block/core/frontend/durable/provider_chunk_lifetime_test.go +++ b/seaweed-block/core/frontend/durable/provider_chunk_lifetime_test.go @@ -542,24 +542,41 @@ func TestWALStoreChunk_CloseSettlesDeferredAttach(t *testing.T) { // recovery refuses as a WAL integrity fault. It returns a restore func. func corruptWALWrite(t *testing.T, path string, fill byte) func() { t.Helper() - raw, err := os.ReadFile(path) + // Read the known fixture geometry without touching the owner's locked + // byte zero, and search only the WAL (the extent may contain a copy). + source, err := os.Open(path) if err != nil { t.Fatal(err) } - payload := bytes.Repeat([]byte{fill}, 4096) - at := bytes.Index(raw, payload) - if at < 30 || bytes.Index(raw[at+1:], payload) >= 0 { - t.Fatalf("WAL record for fill %#x not found exactly once", fill) + defer source.Close() + var geometry [16]byte + if _, err := source.ReadAt(geometry[:], 48); err != nil { + t.Fatal(err) } - const hdr = 30 // LSN 8, Reserved 8, Type 1, Flags 1, LBA 8, Length 4 - start := at - hdr - rec := append([]byte(nil), raw[start:at+4096+8]...) + walStart := binary.LittleEndian.Uint64(geometry[:8]) + walSize := binary.LittleEndian.Uint64(geometry[8:]) + if walStart != 8192 || walSize > 64*1024*1024 || walSize < 4096+70 { + t.Fatalf("unexpected v3 fixture geometry %d/%d", walStart, walSize) + } + wal := make([]byte, int(walSize)) + if _, err := source.ReadAt(wal, int64(walStart)); err != nil { + t.Fatal(err) + } + payload := bytes.Repeat([]byte{fill}, 4096) + at := bytes.Index(wal, payload) + // Ignore overlapping matches if the first CRC byte happens to equal fill. + if at < 62 || bytes.Index(wal[at+len(payload):], payload) >= 0 { + t.Fatalf("WAL payload %#x not found exactly once", fill) + } + const hdr = 62 + start := int64(walStart) + int64(at-hdr) + rec := append([]byte(nil), wal[at-hdr:at+4096+8]...) orig := append([]byte(nil), rec...) if rec[16] != 0x01 || binary.LittleEndian.Uint64(rec[8:]) != 0 { t.Fatalf("unexpected WAL record header % x", rec[:hdr]) } - rec[16] = 0x04 // write batch, Reserved stays 0: invalid - binary.LittleEndian.PutUint32(rec[hdr+4096:], crc32.ChecksumIEEE(rec[:hdr+4096])) + rec[16] = 0x04 // invalid native batch: BatchCount remains zero + binary.LittleEndian.PutUint32(rec[hdr+4096:], crc32.Checksum(rec[:hdr+4096], crc32.MakeTable(crc32.Castagnoli))) f, err := os.OpenFile(path, os.O_WRONLY, 0) if err != nil { t.Fatal(err) @@ -609,6 +626,15 @@ func TestWALStoreChunk_StaleWaiterCannotOverrideFailedRecovery(t *testing.T) { if _, err := s.Write(5, block(0xA7)); err != nil { t.Fatal(err) } + // This oracle requires corruption below a persisted W. Default mode C + // intentionally permits losing its newest uncheckpointed batch instead. + ws, ok := s.(*storage.WALStore) + if !ok { + t.Fatalf("unexpected native store %T", s) + } + if err := ws.SetWMode(storage.WModeStrict); err != nil { + t.Fatal(err) + } if _, err := s.Sync(); err != nil { t.Fatal(err) } @@ -683,6 +709,15 @@ func TestWALStoreChunk_FailedRecoveryRetiresAuthorityWait(t *testing.T) { if _, err := s.Write(5, block(0xA7)); err != nil { t.Fatal(err) } + // This oracle requires corruption below a persisted W. Default mode C + // intentionally permits losing its newest uncheckpointed batch instead. + ws, ok := s.(*storage.WALStore) + if !ok { + t.Fatalf("unexpected native store %T", s) + } + if err := ws.SetWMode(storage.WModeStrict); err != nil { + t.Fatal(err) + } if _, err := s.Sync(); err != nil { t.Fatal(err) } @@ -774,6 +809,15 @@ func TestWALStoreChunk_StaleWaiterPastTickCheckCannotAttach(t *testing.T) { if _, err := s.Write(5, block(0xA7)); err != nil { t.Fatal(err) } + // This oracle requires corruption below a persisted W. Default mode C + // intentionally permits losing its newest uncheckpointed batch instead. + ws, ok := s.(*storage.WALStore) + if !ok { + t.Fatalf("unexpected native store %T", s) + } + if err := ws.SetWMode(storage.WModeStrict); err != nil { + t.Fatal(err) + } if _, err := s.Sync(); err != nil { t.Fatal(err) } @@ -781,6 +825,7 @@ func TestWALStoreChunk_StaleWaiterPastTickCheckCannotAttach(t *testing.T) { // Park A's wait inside its projection read, after its tick check. view.arm() + t.Cleanup(func() { close(view.release) }) select { case <-view.parked: case <-time.After(10 * time.Second): diff --git a/seaweed-block/core/frontend/durable/provider_format_v3_test.go b/seaweed-block/core/frontend/durable/provider_format_v3_test.go index a71b789518..f9602b79f0 100644 --- a/seaweed-block/core/frontend/durable/provider_format_v3_test.go +++ b/seaweed-block/core/frontend/durable/provider_format_v3_test.go @@ -32,12 +32,7 @@ func mappedProviderV3(t *testing.T, root string, remote storage.ChunkRemote) *Du t.Fatal(err) } t.Cleanup(func() { _ = p.Close() }) - p.testWALStoreFactory = func(path string, create bool) (*storage.WALStore, error) { - if create { - return storage.CreateMappedWALStoreV3Test(path, 64, 4096, 4) - } - return storage.OpenMappedWALStoreV3Test(path) - } + // Activation closure: use the production selector and provider geometry. return p } @@ -165,7 +160,7 @@ func TestDurableProviderV3_MissingMapRefusesBeforeBackend(t *testing.T) { } } -func TestDurableProviderV3_DefaultSelectorStillCreatesLegacy(t *testing.T) { +func TestDurableProviderV3_DefaultSelectorCreatesV3(t *testing.T) { p, err := NewDurableProvider(ProviderConfig{Impl: ImplWALStore, StorageRoot: t.TempDir(), NumBlocks: 64, BlockSize: 4096}, formatV3View{}) if err != nil { t.Fatal(err) @@ -183,8 +178,8 @@ func TestDurableProviderV3_DefaultSelectorStillCreatesLegacy(t *testing.T) { if _, err = f.ReadAt(hdr[:], 0); err != nil { t.Fatal(err) } - if binary.LittleEndian.Uint16(hdr[4:6]) != 2 { - t.Fatal("default provider activated v3") + if binary.LittleEndian.Uint16(hdr[4:6]) != 3 || binary.LittleEndian.Uint32(hdr[12:16]) != 3 { + t.Fatal("default provider did not select v3/impl3") } } diff --git a/seaweed-block/core/frontend/durable/provider_seed_linux_test.go b/seaweed-block/core/frontend/durable/provider_seed_linux_test.go index 477abdabdf..65c5007223 100644 --- a/seaweed-block/core/frontend/durable/provider_seed_linux_test.go +++ b/seaweed-block/core/frontend/durable/provider_seed_linux_test.go @@ -10,7 +10,6 @@ import ( "os" "path/filepath" "strconv" - "strings" "sync" "syscall" "testing" @@ -47,7 +46,7 @@ func failSeedFD(t *testing.T, root string) func() { fd := -1 for _, e := range entries { name, err := os.Readlink("/proc/self/fd/" + e.Name()) - if err == nil && strings.HasPrefix(name, root+string(os.PathSeparator)) { + if err == nil && name == filepath.Join(root, "v1.bin") { if fd != -1 { t.Fatal("more than one fixture WAL descriptor") } diff --git a/seaweed-block/core/frontend/durable/provider_test.go b/seaweed-block/core/frontend/durable/provider_test.go index 6b70ff437e..310c0afd1c 100644 --- a/seaweed-block/core/frontend/durable/provider_test.go +++ b/seaweed-block/core/frontend/durable/provider_test.go @@ -71,8 +71,8 @@ func TestPhase150_DurableProviderWALMultiBlockOptIn(t *testing.T) { single := run(t, false) multi := run(t, true) - if single != 16 { - t.Fatalf("single encode ops=%d want 16", single) + if single != 4 { + t.Fatalf("native v3 batch encode ops=%d want 4 regardless of legacy option", single) } if multi != 4 { t.Fatalf("multi encode ops=%d want 4", multi) diff --git a/seaweed-block/core/replication/component/apply_gate_scenarios_test.go b/seaweed-block/core/replication/component/apply_gate_scenarios_test.go index 58db25f466..858dbf7bb3 100644 --- a/seaweed-block/core/replication/component/apply_gate_scenarios_test.go +++ b/seaweed-block/core/replication/component/apply_gate_scenarios_test.go @@ -25,6 +25,7 @@ import ( func TestComponent_RecoveryStaleSkip_CoverageStillAdvances(t *testing.T) { component.RunSubstrate(t, "walstore", component.Walstore, func(t *testing.T, c *component.Cluster) { c.WithReplicas(1).WithApplyGate().Start() + primeReplicaZeroBase(t, c, 49) gate := c.ApplyGate(0) if gate == nil { @@ -67,6 +68,7 @@ func TestComponent_RecoveryStaleSkip_CoverageStillAdvances(t *testing.T) { func TestComponent_LiveLaneStaleEntry_FailsLoud(t *testing.T) { component.RunSubstrate(t, "walstore", component.Walstore, func(t *testing.T, c *component.Cluster) { c.WithReplicas(1).WithApplyGate().Start() + primeReplicaZeroBase(t, c, 49) gate := c.ApplyGate(0) // Live-lane lineage (TargetLSN == liveShipTargetLSN == 1). @@ -114,6 +116,7 @@ func TestComponent_LiveLaneStaleEntry_FailsLoud(t *testing.T) { func TestComponent_LanePurity_CallerControlsDispatch(t *testing.T) { component.RunSubstrate(t, "walstore", component.Walstore, func(t *testing.T, c *component.Cluster) { c.WithReplicas(1).WithApplyGate().Start() + primeReplicaZeroBase(t, c, 49) gate := c.ApplyGate(0) @@ -156,6 +159,7 @@ func TestComponent_LanePurity_CallerControlsDispatch(t *testing.T) { func TestComponent_OptionCHybrid_WalstoreSeed(t *testing.T) { component.RunSubstrate(t, "walstore", component.Walstore, func(t *testing.T, c *component.Cluster) { c.WithReplicas(1).WithApplyGate().Start() + primeReplicaZeroBase(t, c, 49) // Pre-apply on the replica's substrate directly to populate // dirty map (which walstore's AppliedLSNs() reads). @@ -170,7 +174,7 @@ func TestComponent_OptionCHybrid_WalstoreSeed(t *testing.T) { } // Trigger session init (any apply does it). Use unrelated LBA. - gate.ApplyRecovery(recov, 99, makeData(0xCC), 60) + gate.ApplyRecovery(recov, 99, makeData(0xCC), 51) // Now LBA=5's seed should be visible. seedLSN, ok := gate.SessionAppliedLSN(7, 5) diff --git a/seaweed-block/core/replication/component/cluster_test.go b/seaweed-block/core/replication/component/cluster_test.go index d9853bbc0d..5e01b108a8 100644 --- a/seaweed-block/core/replication/component/cluster_test.go +++ b/seaweed-block/core/replication/component/cluster_test.go @@ -134,7 +134,7 @@ func TestComponent_TwoReplicas_BothConverge(t *testing.T) { // pre-existing replica state. func TestComponent_PartialReplicaThenCatchUp(t *testing.T) { component.RunMatrix(t, func(t *testing.T, c *component.Cluster) { - c.WithReplicas(1).Start() + c.WithReplicas(1).WithApplyGate().Start() // Stage 1: primary + replica both have LBAs 0..4. for i := 0; i < 5; i++ { data := make([]byte, component.DefaultBlockSize) diff --git a/seaweed-block/core/replication/component/format_v3_fixture_test.go b/seaweed-block/core/replication/component/format_v3_fixture_test.go new file mode 100644 index 0000000000..a05d7f239b --- /dev/null +++ b/seaweed-block/core/replication/component/format_v3_fixture_test.go @@ -0,0 +1,24 @@ +package component_test + +import ( + "github.com/seaweedfs/seaweed-block/core/replication/component" + "github.com/seaweedfs/seaweed-block/core/storage" + "testing" +) + +// These scenarios prime an otherwise zero replica at a chosen historical +// floor. V3 requires a complete BASE anchor before any later sparse LSN. +func primeReplicaZeroBase(t *testing.T, c *component.Cluster, floor uint64) { + t.Helper() + s, ok := c.Replica(0).Store.(*storage.WALStore) + if !ok || !s.FormatV3() { + return + } + h, err := s.BeginBaseInstall(floor, [16]byte{0x61}) + if err != nil { + t.Fatal(err) + } + if err := h.MarkBaseComplete(); err != nil { + t.Fatal(err) + } +} diff --git a/seaweed-block/core/replication/component/frontier_regression_test.go b/seaweed-block/core/replication/component/frontier_regression_test.go index 51b70d2630..fa7d1386e5 100644 --- a/seaweed-block/core/replication/component/frontier_regression_test.go +++ b/seaweed-block/core/replication/component/frontier_regression_test.go @@ -35,7 +35,7 @@ import ( // INV-REPL-CATCHUP-FRONTIER-MONOTONIC-UNDER-OVER-SCAN. func TestComponent_CatchupFromBelowReplicaLSN_NoFrontierRegression(t *testing.T) { component.RunMatrix(t, func(t *testing.T, c *component.Cluster) { - c.WithReplicas(1).Start() + c.WithReplicas(1).WithApplyGate().Start() // Stage 1: prime replica with LBAs 0..4 at LSNs 1..5. // (Use ReplicaApply to install state directly — bypasses diff --git a/seaweed-block/core/replication/component/stale_entry_adversarial_test.go b/seaweed-block/core/replication/component/stale_entry_adversarial_test.go index f583a03c24..d9bf8652df 100644 --- a/seaweed-block/core/replication/component/stale_entry_adversarial_test.go +++ b/seaweed-block/core/replication/component/stale_entry_adversarial_test.go @@ -69,6 +69,7 @@ func TestComponent_Adversarial_StaleEntryDoesNotRegress(t *testing.T) { // Stage 2: replica is primed with the LATEST state (LSN=2, // value B). Simulates "replica caught up via prior live // ship before our catch-up session." + primeReplicaZeroBase(t, c, 1) c.ReplicaApply(0, 7, dataB, 2) c.Replica(0).Store.Sync() diff --git a/seaweed-block/core/replication/component/t4d3_scenarios_test.go b/seaweed-block/core/replication/component/t4d3_scenarios_test.go index bc306baea2..37a41242d4 100644 --- a/seaweed-block/core/replication/component/t4d3_scenarios_test.go +++ b/seaweed-block/core/replication/component/t4d3_scenarios_test.go @@ -215,6 +215,7 @@ func TestT4d3_RecoveryTargetLSN1_RoutesByConnectionContext(t *testing.T) { // the catch-up session fails. Recovery lane must stale-skip. replicaData := make([]byte, component.DefaultBlockSize) replicaData[0] = 0x22 + primeReplicaZeroBase(t, c, 1) c.ReplicaApply(0, 0, replicaData, 2) result := c.CatchUpReplica(0) diff --git a/seaweed-block/core/storage/activation_recycle_v3_test.go b/seaweed-block/core/storage/activation_recycle_v3_test.go new file mode 100644 index 0000000000..6a22f353e8 --- /dev/null +++ b/seaweed-block/core/storage/activation_recycle_v3_test.go @@ -0,0 +1,67 @@ +package storage + +import "testing" + +// Public recycle knobs retain their meaning; setup uses actual acknowledged +// writes and complete checkpoints rather than fabricating legacy fields. +func TestWALStoreV3RecycleFloorCompatibilityMatrix(t *testing.T) { + for _, tc := range []struct { + name string + floor uint64 + active, install, disable, prior bool + want uint64 + }{ + {name: "nil", want: 5}, + {name: "inactive", floor: 2, install: true, want: 5}, + {name: "active", floor: 2, active: true, install: true, want: 2}, + {name: "above", floor: 9, active: true, install: true, want: 5}, + {name: "disable", floor: 2, active: true, install: true, disable: true, want: 5}, + {name: "no_regression", floor: 1, active: true, install: true, prior: true, want: 3}, + } { + t.Run(tc.name, func(t *testing.T) { + s, _ := newMappedCheckpointStoreV3(t) + for i := 1; i <= 5; i++ { + writeSynced(t, s, uint32(i), uint32(i)) + if tc.prior && i == 3 { + if err := s.flusher.flushOnce(); err != nil { + t.Fatal(err) + } + } + } + if tc.install { + s.SetRecycleFloorSource(&fakeRecycleFloorSource{floor: tc.floor, anyActive: tc.active}) + } + if tc.disable { + s.SetRecycleFloorSource(nil) + } + if err := s.flusher.flushOnce(); err != nil { + t.Fatal(err) + } + if cp := s.CheckpointLSN(); cp != tc.want { + t.Fatalf("checkpoint=%d want %d", cp, tc.want) + } + for i := 1; i <= 5; i++ { + got, err := s.Read(uint32(i)) + if err != nil || got[0] != byte(i) { + t.Fatalf("LBA%d: %v", i, err) + } + } + }) + } +} + +func TestWALStoreV3RetentionCompatibilityMatrix(t *testing.T) { + for _, tc := range []struct{ retain, tail uint64 }{{0, 20830}, {1, 16664}, {10, 0}} { + s, _ := newMappedCheckpointStoreV3(t) + s.SetRecoveryRetentionLSNs(tc.retain) + for i := 1; i <= 5; i++ { + writeSynced(t, s, uint32(i), uint32(i)) + } + if err := s.flusher.flushOnce(); err != nil { + t.Fatal(err) + } + if got := s.v3.pub.current().RetainedTail; got != tc.tail { + t.Fatalf("retention%d: tail=%d want %d", tc.retain, got, tc.tail) + } + } +} diff --git a/seaweed-block/core/storage/block_metadata.go b/seaweed-block/core/storage/block_metadata.go index 8dfda256d2..120ae6d4a6 100644 --- a/seaweed-block/core/storage/block_metadata.go +++ b/seaweed-block/core/storage/block_metadata.go @@ -45,14 +45,20 @@ type BlockMetadataBinding struct { // or recovery begins. On create it declares a layout without writing bytes; // on open it must accept exactly the stored version. No registry or hook chain. type BlockMetadataFactory func(BlockMetadataFile, BlockMetadataLayout) (BlockMetadataBinding, error) -type WALStoreOptions struct{ MetadataFactory BlockMetadataFactory } +type WALStoreOptions struct { + MetadataFactory BlockMetadataFactory + // ChunkBlocks fixes the owned map geometry at create. Zero uses 1024. + ChunkBlocks uint32 + // WMode is C (lagged) by default; A (strict) is an opt-in per volume. + WMode WMode +} func bindBlockMetadata(f *os.File, sb *superblock, opts WALStoreOptions, creating, readonly bool) (BlockMetadata, int64, error) { if sb.WALOffset > math.MaxInt64 || sb.WALSize > math.MaxInt64-sb.WALOffset || sb.VolumeSize > math.MaxInt64-sb.WALOffset-sb.WALSize { return nil, 0, fmt.Errorf("storage: extent size overflow") } base := sb.WALOffset + sb.WALSize + sb.VolumeSize - nativeVersion := uint32(WALStoreImplVersion) + nativeVersion := uint32(1) // frozen v2 metadata seam if sb.Version == superblockVersionV3 { nativeVersion = walStoreImplVersion3 } diff --git a/seaweed-block/core/storage/block_metadata_test.go b/seaweed-block/core/storage/block_metadata_test.go index 9aab488a5a..6324d9beb7 100644 --- a/seaweed-block/core/storage/block_metadata_test.go +++ b/seaweed-block/core/storage/block_metadata_test.go @@ -2,7 +2,6 @@ package storage import ( "bytes" - "encoding/binary" "errors" "os" "path/filepath" @@ -83,11 +82,16 @@ func TestBlockMetadata_BarrierErrorBlocksCheckpointAndDirectFrontier(t *testing. h := &recordingMetadata{barrierErr: sentinel} s, _ := metadataStore(t, h) cp, tail := s.CheckpointLSN(), walLogicalTail(s) + var install InstallHandle if direct { - if err := s.WriteExtentDirect(3, makeBlock(4096, 0x32)); err != nil { + var err error + install, err = s.BeginBaseInstall(7, [16]byte{1}) + if err != nil { + t.Fatal(err) + } + if err := install.WriteBase(3, makeBlock(4096, 0x32)); err != nil { t.Fatal(err) } - s.AdvanceFrontier(7) } else { if _, err := s.Write(3, makeBlock(4096, 0x32)); err != nil { t.Fatal(err) @@ -98,7 +102,7 @@ func TestBlockMetadata_BarrierErrorBlocksCheckpointAndDirectFrontier(t *testing. } var err error if direct { - _, err = s.Sync() + err = install.MarkBaseComplete() } else { err = s.flusher.flushOnce() } @@ -112,12 +116,19 @@ func TestBlockMetadata_WriteAndVerifyRouting(t *testing.T) { h := &recordingMetadata{} s, p := metadataStore(t, h) sentinel := errors.New("metadata refusal") + install, err := s.BeginBaseInstall(0, [16]byte{1}) + if err != nil { + t.Fatal(err) + } h.writeErr = sentinel - if err := s.WriteExtentDirect(3, makeBlock(4096, 0x33)); !errors.Is(err, sentinel) { + if err := install.WriteBase(3, makeBlock(4096, 0x33)); !errors.Is(err, sentinel) { t.Fatalf("write hook bypassed: %v", err) } h.writeErr = nil - if err := s.WriteExtentDirect(3, makeBlock(4096, 0x33)); err != nil { + if err := install.WriteBase(3, makeBlock(4096, 0x33)); err != nil { + t.Fatal(err) + } + if err := install.MarkBaseComplete(); err != nil { t.Fatal(err) } h.readErr = sentinel @@ -182,11 +193,12 @@ func TestBlockMetadata_SeedFailureRetry(t *testing.T) { sentinel := errors.New("deferred metadata not durable") hook := &recordingMetadata{barrierErr: sentinel} s, path := metadataStore(t, hook) - if err := s.WriteExtentDirect(3, makeBlock(4096, 0x45)); err != nil { + // Quiescent pre-seed image bytes, not an admitted direct-BASE mutation. + if err := s.writeExtentUnlocked(3, makeBlock(4096, 0x45)); err != nil { t.Fatal(err) } - persist := s.syncDirectFrontierMetadata - s.syncDirectFrontierMetadata = func(data []byte) error { + persist := s.v3.pub.io.writeSlot + s.v3.pub.io.writeSlot = func(off int64, data []byte) error { if hook.barriers != 2 { t.Errorf("seed persistence before retry barrier: %d", hook.barriers) } @@ -194,7 +206,7 @@ func TestBlockMetadata_SeedFailureRetry(t *testing.T) { if _, err := s.fd.ReadAt(marker, hook.end); err != nil || marker[0] != 1 { t.Errorf("seed persisted before deferred marker: %v %v", marker, err) } - return persist(data) + return persist(off, data) } if err := s.SeedChunkFrontier(7); !errors.Is(err, sentinel) { t.Fatalf("seed bypassed deferred metadata error: %v", err) @@ -205,11 +217,7 @@ func TestBlockMetadata_SeedFailureRetry(t *testing.T) { if r, _, h := s.Boundaries(); r != 0 || h != 0 { t.Fatalf("failed seed published boundaries: %d %d", r, h) } - header := make([]byte, 4096) - if _, err := s.fd.ReadAt(header, 0); err != nil { - t.Fatal(err) - } - if binary.LittleEndian.Uint64(header[72:80]) != 0 { + if s.v3.pub.current().CheckpointLSN != 0 { t.Fatal("failed seed persisted checkpoint") } hook.barrierErr = nil diff --git a/seaweed-block/core/storage/chunk_fake_remote_test.go b/seaweed-block/core/storage/chunk_fake_remote_test.go index 7eec202e29..f3eef79172 100644 --- a/seaweed-block/core/storage/chunk_fake_remote_test.go +++ b/seaweed-block/core/storage/chunk_fake_remote_test.go @@ -696,7 +696,7 @@ func closeBounded(t *testing.T, s *WALStore) { func newChunkTestStore(t *testing.T) (*WALStore, string) { t.Helper() path := filepath.Join(t.TempDir(), "vol.bin") - s, err := CreateWALStore(path, ctNumBlocks, ctBlockSize) + s, err := CreateWALStoreWithOptions(path, ctNumBlocks, ctBlockSize, WALStoreOptions{ChunkBlocks: ctChunkBlocks}) if err != nil { t.Fatal(err) } @@ -710,7 +710,7 @@ func newChunkTestStore(t *testing.T) (*WALStore, string) { func crashableStore(t *testing.T) (*WALStore, string, func()) { t.Helper() path := filepath.Join(t.TempDir(), "vol.bin") - s, err := CreateWALStore(path, ctNumBlocks, ctBlockSize) + s, err := CreateWALStoreWithOptions(path, ctNumBlocks, ctBlockSize, WALStoreOptions{ChunkBlocks: ctChunkBlocks}) if err != nil { t.Fatal(err) } @@ -1133,3 +1133,67 @@ func waitReconciledForTest(t *testing.T, layer chunkLayer) { time.Sleep(time.Millisecond) } } + +// TODO(format-v3 row 14a): explicit C11 bitmap-engine fixtures only. +func newLegacyChunkTestStore(t *testing.T) (*WALStore, string) { + t.Helper() + path := filepath.Join(t.TempDir(), "vol.bin") + s, err := createLegacyWALStoreWithOptions(path, ctNumBlocks, ctBlockSize, WALStoreOptions{ChunkBlocks: ctChunkBlocks}) + if err != nil { + t.Fatal(err) + } + s.DisableAutoFlushForRecoveryTest() + t.Cleanup(func() { closeBounded(t, s) }) + return s, path +} + +// crashableStore is a store a test may crash; it is closed at cleanup only +// if it was not crashed. +func legacyCrashableStore(t *testing.T) (*WALStore, string, func()) { + t.Helper() + path := filepath.Join(t.TempDir(), "vol.bin") + s, err := createLegacyWALStoreWithOptions(path, ctNumBlocks, ctBlockSize, WALStoreOptions{ChunkBlocks: ctChunkBlocks}) + if err != nil { + t.Fatal(err) + } + s.DisableAutoFlushForRecoveryTest() + crashed := false + t.Cleanup(func() { + if !crashed { + closeBounded(t, s) + } + }) + return s, path, func() { + crashed = true + s.committer.Stop() + if err := s.fd.Close(); err != nil { + t.Fatal(err) + } + } +} + +// reopen opens and recovers a crashed store; it may be crashed again. +func legacyReopen(t *testing.T, path string) (*WALStore, func()) { + t.Helper() + s, err := openLegacyWALStoreForTest(path) + if err != nil { + t.Fatal(err) + } + crashed := false + t.Cleanup(func() { + if !crashed { + closeBounded(t, s) + } + }) + s.DisableAutoFlushForRecoveryTest() + if _, err := s.Recover(); err != nil { + t.Fatalf("local recovery: %v", err) + } + return s, func() { + crashed = true + s.committer.Stop() + if err := s.fd.Close(); err != nil { + t.Fatal(err) + } + } +} diff --git a/seaweed-block/core/storage/chunk_frontier_test.go b/seaweed-block/core/storage/chunk_frontier_test.go index f92846b4f6..c4d2ecc613 100644 --- a/seaweed-block/core/storage/chunk_frontier_test.go +++ b/seaweed-block/core/storage/chunk_frontier_test.go @@ -6,7 +6,7 @@ import ( ) func TestSeedChunkFrontierMetadataFailureRetry(t *testing.T) { - s, path := newChunkTestStore(t) + s, path := newLegacyChunkTestStore(t) s.DisableAutoFlushForRecoveryTest() syncMetadata := s.syncDirectFrontierMetadata s.syncDirectFrontierMetadata = func([]byte) error { return errors.New("injected metadata fsync failure") } @@ -29,7 +29,7 @@ func TestSeedChunkFrontierMetadataFailureRetry(t *testing.T) { t.Fatalf("same-store seed retry after a failed fsync: %v; want ErrFsyncFailed", err) } _ = s.Close() - reopened, err := OpenWALStore(path) + reopened, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -51,7 +51,7 @@ func TestSeedChunkFrontierMetadataFailureRetry(t *testing.T) { reopened.committer.Stop() _ = reopened.fd.Close() // crash reopenedOpen = false - again, err := OpenWALStore(path) + again, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/chunk_layer_c11_test.go b/seaweed-block/core/storage/chunk_layer_c11_test.go index acb0259f0f..4e1177a46b 100644 --- a/seaweed-block/core/storage/chunk_layer_c11_test.go +++ b/seaweed-block/core/storage/chunk_layer_c11_test.go @@ -28,6 +28,9 @@ func extentBytes(t *testing.T, s *WALStore, lba uint32) []byte { // walLogicalTail is the WAL writer's physical recycling position. func walLogicalTail(s *WALStore) uint64 { + if s.v3 != nil { + return s.v3.pub.current().RetainedTail + } s.wal.mu.Lock() defer s.wal.mu.Unlock() return s.wal.logicalTail @@ -96,7 +99,7 @@ func flushWithin(t *testing.T, s *WALStore, what string) error { // no WALStore re-entry. (A BASE mark must also be a constant-time flag; that // cost bound is measured in the implementation PR, not proven here.) func TestChunkLayer_C11_ExtentCallbackIsPureInMemory(t *testing.T) { - s, _ := newChunkTestStore(t) + s, _ := newLegacyChunkTestStore(t) f := newFakeChunkRemote() cfg := ctConfig(1) bm := cfg.Bitmap.(*fakeBitmapStore) @@ -141,7 +144,7 @@ func TestChunkLayer_C11_ExtentCallbackIsPureInMemory(t *testing.T) { // refuses the advance (checkpoint and WAL tail unchanged), and a restart // still captures the chunk from the WAL. func TestChunkLayer_C11_BitmapPersistedBeforeWALRecycle(t *testing.T) { - s, path, crash := crashableStore(t) + s, path, crash := legacyCrashableStore(t) f := newFakeChunkRemote() cfg := ctConfig(1) bm := cfg.Bitmap.(*fakeBitmapStore) @@ -216,7 +219,7 @@ func TestChunkLayer_C11_BitmapPersistedBeforeWALRecycle(t *testing.T) { bm.failSave = nil bm.mu.Unlock() crash() - s2, _ := reopen(t, path) + s2, _ := legacyReopen(t, path) layer2 := mustAttach(t, s2, f, cfg) before := f.stats() if _, err := layer2.Capture(ctTimeout(t)); err != nil { @@ -232,7 +235,7 @@ func TestChunkLayer_C11_BitmapPersistedBeforeWALRecycle(t *testing.T) { // and its WAL recycled (so only the bitmap remembers it). The cut's Reset // must keep that chunk dirty, and after a crash the next capture uploads it. func TestChunkLayer_C11_RolloverKeepsPostCutDirt(t *testing.T) { - s, path, crash := crashableStore(t) + s, path, crash := legacyCrashableStore(t) f := newFakeChunkRemote() cfg := ctConfig(1) bm := cfg.Bitmap.(*fakeBitmapStore) @@ -266,7 +269,7 @@ func TestChunkLayer_C11_RolloverKeepsPostCutDirt(t *testing.T) { t.Fatal("the cut's Reset kept chunk 1, which the cut captured") } crash() - s2, _ := reopen(t, path) + s2, _ := legacyReopen(t, path) layer2 := mustAttach(t, s2, f, cfg) before := f.stats() if _, err := layer2.Capture(ctTimeout(t)); err != nil { @@ -291,7 +294,7 @@ func TestChunkLayer_C11_RolloverKeepsPostCutDirt(t *testing.T) { // Then the host crashes. func c11BaseFixture(t *testing.T, failSave, complete bool) (path string, f *fakeChunkRemote, cfg chunkLayerConfig, frontier uint64) { t.Helper() - s, path, crash := crashableStore(t) + s, path, crash := legacyCrashableStore(t) f = newFakeChunkRemote() cfg = ctConfig(1) bm := cfg.Bitmap.(*fakeBitmapStore) @@ -425,7 +428,7 @@ func rerunBase(t *testing.T, s *WALStore, layer chunkLayer, frontier uint64) { func TestChunkLayer_C11_BaseRebuildRecovery(t *testing.T) { t.Run("interrupted install", func(t *testing.T) { path, f, cfg, frontier := c11BaseFixture(t, false, false) - s2, _ := reopen(t, path) + s2, _ := legacyReopen(t, path) layer2 := mustAttach(t, s2, f, cfg) before := f.stats() if _, err := layer2.Capture(ctTimeout(t)); !errors.Is(err, errChunkCaptureRefused) { @@ -439,13 +442,13 @@ func TestChunkLayer_C11_BaseRebuildRecovery(t *testing.T) { }) t.Run("completed install", func(t *testing.T) { path, f, cfg, _ := c11BaseFixture(t, false, true) - s2, _ := reopen(t, path) + s2, _ := legacyReopen(t, path) layer2 := mustAttach(t, s2, f, cfg) assertBaseCutUploadsChangedChunks(t, layer2, f, cfg) }) t.Run("bitmap save fails on the direct-frontier path", func(t *testing.T) { path, f, cfg, frontier := c11BaseFixture(t, true, false) - s2, _ := reopen(t, path) + s2, _ := legacyReopen(t, path) layer2 := mustAttach(t, s2, f, cfg) if _, err := layer2.Capture(ctTimeout(t)); !errors.Is(err, errChunkCaptureRefused) { t.Fatalf("cut after an install whose frontier never became durable: got %v, want errChunkCaptureRefused", err) @@ -459,7 +462,7 @@ func TestChunkLayer_C11_BaseRebuildRecovery(t *testing.T) { // then fails; after a crash the next capture may over-report, but its image // is exact and nothing is missed. func TestChunkLayer_C11_SaveThenCheckpointFailureOverReportsOnly(t *testing.T) { - s, path, crash := crashableStore(t) + s, path, crash := legacyCrashableStore(t) f := newFakeChunkRemote() cfg := ctConfig(1) layer := mustAttach(t, s, f, cfg) @@ -477,7 +480,7 @@ func TestChunkLayer_C11_SaveThenCheckpointFailureOverReportsOnly(t *testing.T) { t.Fatal("the flush succeeded although its checkpoint publish failed") } crash() - s2, _ := reopen(t, path) + s2, _ := legacyReopen(t, path) layer2 := mustAttach(t, s2, f, cfg) if _, err := layer2.Capture(ctTimeout(t)); err != nil { t.Fatalf("capture after restart: %v", err) @@ -493,7 +496,7 @@ func TestChunkLayer_C11_SaveThenCheckpointFailureOverReportsOnly(t *testing.T) { // and keep the refs of the unchanged chunks. func c11RestartFixture(t *testing.T, beforeReattach func(bm *fakeBitmapStore)) { t.Helper() - s, path, crash := crashableStore(t) + s, path, crash := legacyCrashableStore(t) f := newFakeChunkRemote() cfg := ctConfig(1) bm := cfg.Bitmap.(*fakeBitmapStore) @@ -511,7 +514,7 @@ func c11RestartFixture(t *testing.T, beforeReattach func(bm *fakeBitmapStore)) { t.Fatal(err) } crash() - s2, _ := reopen(t, path) + s2, _ := legacyReopen(t, path) if beforeReattach != nil { bm.mu.Lock() beforeReattach(bm) @@ -567,7 +570,7 @@ func TestChunkLayer_C11_LostOrMismatchedBitmapFallsBackToHashCompare(t *testing. // promoted replica's bitmap covers its applied chunks before their WAL // entries are recycled. func TestChunkLayer_C11_ReplicaApplyKeepsBitmap(t *testing.T) { - s, _ := newChunkTestStore(t) + s, _ := newLegacyChunkTestStore(t) f := newFakeChunkRemote() cfg := ctConfig(1) bm := cfg.Bitmap.(*fakeBitmapStore) diff --git a/seaweed-block/core/storage/chunk_layer_contract_test.go b/seaweed-block/core/storage/chunk_layer_contract_test.go index d4f7d83a15..ad2377faba 100644 --- a/seaweed-block/core/storage/chunk_layer_contract_test.go +++ b/seaweed-block/core/storage/chunk_layer_contract_test.go @@ -214,6 +214,11 @@ func TestChunkLayer_C3_EveryHeadIsExactUnderConcurrentWrites(t *testing.T) { } if err == nil { err = s.flusher.flushOnce() + // A concurrent cut can invalidate a prepared checkpoint map; + // the production worker retries this explicit stale-proof outcome. + if errors.Is(err, ErrMapCoverageStale) { + err = nil + } } if err != nil { werr <- err @@ -278,7 +283,11 @@ func TestChunkLayer_C3_WriteDuringCopyWaitsForTheCut(t *testing.T) { f := newFakeChunkRemote() f.seedHead(t, src, 10, 1) s, _ := newChunkTestStore(t) - s.AdvanceFrontier(10) // the log continues from HEAD's remote_lsn (W4b's job in production) + func() { + if err := s.SeedChunkFrontier(10); err != nil { + t.Fatal(err) + } + }() // the log continues from HEAD's remote_lsn (W4b's job in production) cfg := ctConfig(2) cfg.FreshFromHead = true layer := mustAttach(t, s, f, cfg) @@ -382,29 +391,38 @@ func TestChunkLayer_C4_WritesDuringUploadAndBaseAreCapturedNext(t *testing.T) { t.Fatalf("second HEAD remote_lsn %d still misses the mid-upload write %d", h.RemoteLSN, during) } - // Rebuild BASE, bracketed: no cut runs between Begin and End. - if err := layer.BeginBaseInstall(); err != nil { - t.Fatalf("BeginBaseInstall: %v", err) - } + // Rebuild through the v3 store handle. The admitted BASE is the full + // image at the last cut, plus the replacement block, at a new floor. + image := f.imageOf(t, f.stats().head) base := makeBlock(ctBlockSize, 0xBA) - if err := s.WriteExtentDirect(20, base); err != nil { + copy(image[20*ctBlockSize:21*ctBlockSize], base) + frontier := during + 10 + handle, err := s.BeginBaseInstall(frontier, [16]byte{0x44}) + if err != nil { t.Fatal(err) } - frontier := during + 10 - s.AdvanceFrontier(frontier) + for lba := uint32(0); lba < ctNumBlocks; lba++ { + data := image[int(lba)*ctBlockSize : int(lba+1)*ctBlockSize] + if err := handle.WriteBase(lba, data); err != nil { + t.Fatal(err) + } + } w.record(frontier, 20, base) - if _, err := s.Sync(); err != nil { - t.Fatal(err) + if _, err := s.Sync(); !errors.Is(err, ErrBaseInstalling) { + t.Fatalf("logical Sync during install: %v", err) } before := f.stats() if _, err := layer.Capture(ctTimeout(t)); !errors.Is(err, errChunkCaptureRefused) { - t.Fatalf("Capture during a BASE install: got %v, want errChunkCaptureRefused", err) + t.Fatalf("capture while installing: %v", err) } if after := f.stats(); after.puts != before.puts || after.cas != before.cas { - t.Fatalf("capture during a BASE install made %d puts and %d CAS calls", after.puts-before.puts, after.cas-before.cas) + t.Fatal("capture during install made remote effects") } - if err := layer.EndBaseInstall(frontier); err != nil { - t.Fatalf("EndBaseInstall after the durable frontier: %v", err) + if err := handle.MarkBaseComplete(); err != nil { + t.Fatal(err) + } + if _, err := s.Sync(); err != nil { + t.Fatal(err) } waitReconciledForTest(t, layer) // the BASE is reconciled against HEAD first if _, err := layer.Capture(ctTimeout(t)); err != nil { diff --git a/seaweed-block/core/storage/chunk_layer_detach_test.go b/seaweed-block/core/storage/chunk_layer_detach_test.go index 4561a815a7..027492f0fa 100644 --- a/seaweed-block/core/storage/chunk_layer_detach_test.go +++ b/seaweed-block/core/storage/chunk_layer_detach_test.go @@ -111,7 +111,11 @@ func TestChunkCut_NewHolderClearsDetachedState(t *testing.T) { f.mu.Unlock() s, _ := newChunkTestStore(t) - s.AdvanceFrontier(10) // the log continues from HEAD's remote_lsn (W4b's job in production) + func() { + if err := s.SeedChunkFrontier(10); err != nil { + t.Fatal(err) + } + }() // the log continues from HEAD's remote_lsn (W4b's job in production) cfg := ctConfig(2) cfg.FreshFromHead = true layer := mustAttach(t, s, f, cfg) diff --git a/seaweed-block/core/storage/chunk_layer_fresh_bitmap_test.go b/seaweed-block/core/storage/chunk_layer_fresh_bitmap_test.go index aabc2f8c9d..f0a06ffbdc 100644 --- a/seaweed-block/core/storage/chunk_layer_fresh_bitmap_test.go +++ b/seaweed-block/core/storage/chunk_layer_fresh_bitmap_test.go @@ -53,7 +53,7 @@ func TestChunkLayer_LostBitmapReconciles(t *testing.T) { copy(src, makeBlock(ctBlockSize, 0x44)) // HEAD's block 0 differs from the local image f := newFakeChunkRemote() f.seedHead(t, src, 0, 0) // an older epoch: this holder may publish over it - s, _ := newChunkTestStore(t) + s, _ := newLegacyChunkTestStore(t) layer := mustAttach(t, s, f, ctConfig(1)) // waits for reconciliation if st := layer.Stats(); st.Reconciling || st.ReconcileTotal == 0 || st.ReconcileDone != st.ReconcileTotal { t.Fatalf("an existing volume without a bitmap did not reconcile: reconciling=%v done=%d/%d", st.Reconciling, st.ReconcileDone, st.ReconcileTotal) diff --git a/seaweed-block/core/storage/chunk_layer_lsn_order_test.go b/seaweed-block/core/storage/chunk_layer_lsn_order_test.go index 467ef39780..988c9b6805 100644 --- a/seaweed-block/core/storage/chunk_layer_lsn_order_test.go +++ b/seaweed-block/core/storage/chunk_layer_lsn_order_test.go @@ -15,7 +15,7 @@ func TestChunkCut_RemoteLSNNeverDecreases(t *testing.T) { copy(src, makeBlock(ctBlockSize, 0x44)) f := newFakeChunkRemote() f.seedHead(t, src, 10, 1) - s, _ := newChunkTestStore(t) + s, _ := newLegacyChunkTestStore(t) cfg := ctConfig(2) cfg.FreshFromHead = true layer := mustAttach(t, s, f, cfg) diff --git a/seaweed-block/core/storage/chunk_layer_precopy_test.go b/seaweed-block/core/storage/chunk_layer_precopy_test.go index d9d92f5a42..53817f8390 100644 --- a/seaweed-block/core/storage/chunk_layer_precopy_test.go +++ b/seaweed-block/core/storage/chunk_layer_precopy_test.go @@ -24,6 +24,11 @@ func precopyLayer(t *testing.T, bound, n int) (*WALStore, *fakeChunkRemote, *chu cfg.FreshFromHead = true cfg.BarrierBound = bound l := mustAttach(t, s, f, cfg).(*chunkLayerImpl) + // A new v3 map is conservatively UNKNOWN. Publish the zero baseline + // first so this control isolates subsequent pre-copy redirty behavior. + if _, err := l.Cut(ctTimeout(t)); err != nil { + t.Fatal(err) + } w := newWriteLog() for c := 0; c < n; c++ { w.write(t, s, uint32(c*ctChunkBlocks+1), byte(0x10+c)) @@ -203,7 +208,7 @@ func TestChunkPrecopy_LowerLSNApplyAfterStagingIsNotLost(t *testing.T) { for _, flushed := range []bool{false, true} { name := map[bool]string{true: "flushed", false: "in the WAL"}[flushed] t.Run(name, func(t *testing.T) { - s, _ := newChunkTestStore(t) + s, _ := newLegacyChunkTestStore(t) f := newFakeChunkRemote() cfg := ctConfig(1) cfg.FreshFromHead = true @@ -302,7 +307,7 @@ func TestChunkPrecopy_BarrierSyncFailureSettlesStagedIntents(t *testing.T) { // same-open Recover. A chunk staged before it must not be reused: // HEAD at the recovered H has the recovered bytes. func TestChunkPrecopy_RecoverAfterStagingInvalidatesTheStage(t *testing.T) { - s, f, l, _ := precopyLayer(t, 1, 3) // chunk 0 staged in round 0; bound 1 + s, f, l, _ := legacyPrecopyLayer(t, 1, 3) // chunk 0 staged in round 0; bound 1 want := makeBlock(ctBlockSize, 0xa7) recovered := false l.testAfterStageHook = func(round int) { @@ -363,7 +368,7 @@ func plantRecordPastHead(t *testing.T, s *WALStore, lba uint64, data []byte) { // barrier, so the cut's HEAD at H never holds post-H bytes; the recovered // bytes are published by the next cut. func TestChunkCut_RecoverWaitsForTheCaptureBarrier(t *testing.T) { - s, f, l, w := precopyLayer(t, 0, 2) // no bound: the barrier copies all + s, f, l, w := legacyPrecopyLayer(t, 0, 2) // no bound: the barrier copies all newer := makeBlock(ctBlockSize, 0xa7) partialBatchPrefix(t, s, newer) recovered := make(chan error, 1) @@ -405,3 +410,19 @@ func TestChunkCut_RecoverWaitsForTheCaptureBarrier(t *testing.T) { t.Fatalf("next cut H=%d (prev %d): LBA 0 %#x..., want the recovered %#x...", r2.H, r.H, got[0], newer[0]) } } + +// TODO(format-v3 row 14a): raw v2 surgery/nonmonotone fixture only. +func legacyPrecopyLayer(t *testing.T, bound, n int) (*WALStore, *fakeChunkRemote, *chunkLayerImpl, *writeLog) { + t.Helper() + s, _ := newLegacyChunkTestStore(t) + f := newFakeChunkRemote() + cfg := ctConfig(1) + cfg.FreshFromHead = true + cfg.BarrierBound = bound + l := mustAttach(t, s, f, cfg).(*chunkLayerImpl) + w := newWriteLog() + for c := 0; c < n; c++ { + w.write(t, s, uint32(c*ctChunkBlocks+1), byte(0x10+c)) + } + return s, f, l, w +} diff --git a/seaweed-block/core/storage/chunk_layer_races_test.go b/seaweed-block/core/storage/chunk_layer_races_test.go index b7ab868156..8ef33cc2e6 100644 --- a/seaweed-block/core/storage/chunk_layer_races_test.go +++ b/seaweed-block/core/storage/chunk_layer_races_test.go @@ -193,7 +193,11 @@ func TestChunkLayer_StaleAttachDoesNotPublishOverNewerHolder(t *testing.T) { f.heads[len(f.heads)-1].Holder = tc.headHolder f.mu.Unlock() s, _ := newChunkTestStore(t) - s.AdvanceFrontier(5) // the log continues from HEAD's remote_lsn (W4b's job in production) + func() { + if err := s.SeedChunkFrontier(5); err != nil { + t.Fatal(err) + } + }() // the log continues from HEAD's remote_lsn (W4b's job in production) if _, err := s.Write(3, makeBlock(ctBlockSize, 0x33)); err != nil { // stale local change t.Fatal(err) } @@ -328,7 +332,11 @@ func TestChunkLayer_StaleFillNeverAuthorizesUnresolvedExtentRead(t *testing.T) { f := newFakeChunkRemote() f.seedHead(t, src, 5, 1) s, _ := newChunkTestStore(t) - s.AdvanceFrontier(5) // the log continues from HEAD's remote_lsn (W4b's job in production) + func() { + if err := s.SeedChunkFrontier(5); err != nil { + t.Fatal(err) + } + }() // the log continues from HEAD's remote_lsn (W4b's job in production) cfg := ctConfig(2) cfg.FreshFromHead = true layer := mustAttach(t, s, f, cfg) @@ -409,7 +417,11 @@ func TestChunkLayer_FreshHostHashCutFetchesNoUntouchedChunk(t *testing.T) { f := newFakeChunkRemote() f.seedHead(t, src, 5, 1) s, _ := newChunkTestStore(t) - s.AdvanceFrontier(5) // the log continues from HEAD's remote_lsn (W4b's job in production) + func() { + if err := s.SeedChunkFrontier(5); err != nil { + t.Fatal(err) + } + }() // the log continues from HEAD's remote_lsn (W4b's job in production) cfg := ctConfig(2) cfg.FreshFromHead = true layer := mustAttach(t, s, f, cfg) diff --git a/seaweed-block/core/storage/chunk_layer_reconcile_test.go b/seaweed-block/core/storage/chunk_layer_reconcile_test.go index 727019a83c..583df12e83 100644 --- a/seaweed-block/core/storage/chunk_layer_reconcile_test.go +++ b/seaweed-block/core/storage/chunk_layer_reconcile_test.go @@ -39,7 +39,7 @@ func newReconcileFixtureWith(t *testing.T, hold bool, mutate func(bm *fakeBitmap // newReconcileFixtureOpts also lets mutateCfg adjust the reattach config. func newReconcileFixtureOpts(t *testing.T, hold bool, mutate func(bm *fakeBitmapStore), mutateCfg func(cfg *chunkLayerConfig)) *reconcileFixture { t.Helper() - s, path, crash := crashableStore(t) + s, path, crash := legacyCrashableStore(t) f := newFakeChunkRemote() cfg := ctConfig(1) bm := cfg.Bitmap.(*fakeBitmapStore) @@ -57,7 +57,7 @@ func newReconcileFixtureOpts(t *testing.T, hold bool, mutate func(bm *fakeBitmap t.Fatal(err) } crash() - s2, _ := reopen(t, path) + s2, _ := legacyReopen(t, path) bm.mu.Lock() mutate(bm) bm.mu.Unlock() @@ -220,7 +220,7 @@ func TestChunkReconcile_ResultPersisted(t *testing.T) { if err := fx.s.Close(); err != nil { // closes the layer too t.Fatal(err) } - s3, _ := reopen(t, fx.path) + s3, _ := legacyReopen(t, fx.path) l2, err := attachChunkLayer(s3, fx.f, fx.cfg) if err != nil { t.Fatal(err) @@ -290,7 +290,7 @@ func TestChunkReconcile_BaseInstallSupersedesRunningReconciliation(t *testing.T) if err := fx.s.Close(); err != nil { // closes the layer too t.Fatal(err) } - s3, _ := reopen(t, fx.path) + s3, _ := legacyReopen(t, fx.path) defer s3.Close() cfg := fx.cfg cfg.testReconcileHold = nil diff --git a/seaweed-block/core/storage/chunk_layer_stats_test.go b/seaweed-block/core/storage/chunk_layer_stats_test.go index 9782a303d4..7e941311f6 100644 --- a/seaweed-block/core/storage/chunk_layer_stats_test.go +++ b/seaweed-block/core/storage/chunk_layer_stats_test.go @@ -17,8 +17,8 @@ func TestChunkCutStats_PublishedZeroedUnchangedAndNoop(t *testing.T) { if err := flushWithin(t, s, "flush before the cut"); err != nil { // the bitmap counts flushed writes t.Fatal(err) } - if d := layer.Stats().DirtyChunks; d != 2 { - t.Fatalf("dirty chunks before the cut: %d, want 2", d) + if d := layer.Stats().DirtyChunks; d != ctNumBlocks/ctChunkBlocks { + t.Fatalf("dirty chunks before the first cut: %d, want all UNKNOWN chunks", d) } r, err := layer.Cut(ctTimeout(t)) @@ -26,8 +26,8 @@ func TestChunkCutStats_PublishedZeroedUnchangedAndNoop(t *testing.T) { t.Fatal(err) } st := r.Stats - if st.UploadedChunks != 2 || st.UploadedBytes != 2*ctChunkBytes || st.ZeroedChunks != 0 || st.CandidateChunks < 2 { - t.Fatalf("first cut stats %+v: want 2 uploaded chunks (%d bytes), 0 zeroed, >=2 candidates", st, 2*ctChunkBytes) + if st.UploadedChunks != 2 || st.UploadedBytes != 2*ctChunkBytes || st.ZeroedChunks != 0 || st.UnchangedChunks != ctNumBlocks/ctChunkBlocks-2 || st.CandidateChunks != ctNumBlocks/ctChunkBlocks { + t.Fatalf("first cut stats %+v: want 2 uploaded chunks (%d bytes), remaining UNKNOWN zero chunks unchanged, all chunks candidates", st, 2*ctChunkBytes) } if st.CASResult != "ok" || st.CASNs < 0 || st.UploadNs < 0 || st.TotalNs <= 0 { t.Fatalf("first cut timings/result %+v", st) diff --git a/seaweed-block/core/storage/chunk_layer_typed_cause_test.go b/seaweed-block/core/storage/chunk_layer_typed_cause_test.go index 56ed95f4f1..2b647a96dc 100644 --- a/seaweed-block/core/storage/chunk_layer_typed_cause_test.go +++ b/seaweed-block/core/storage/chunk_layer_typed_cause_test.go @@ -9,7 +9,7 @@ import ( // reachable with errors.Is through the layer's errors. func TestChunkCut_BaseInstallRefusalIsTyped(t *testing.T) { - s, _ := newChunkTestStore(t) + s, _ := newLegacyChunkTestStore(t) layer := mustAttach(t, s, newFakeChunkRemote(), ctConfig(1)) newWriteLog().write(t, s, 2, 0x22) if err := layer.BeginBaseInstall(); err != nil { @@ -21,7 +21,7 @@ func TestChunkCut_BaseInstallRefusalIsTyped(t *testing.T) { } func TestChunkCut_UploadFailureIsRemoteUnavailable(t *testing.T) { - s, _ := newChunkTestStore(t) + s, _ := newLegacyChunkTestStore(t) f := newFakeChunkRemote() layer := mustAttach(t, s, f, ctConfig(1)) newWriteLog().write(t, s, 2, 0x22) @@ -34,7 +34,7 @@ func TestChunkCut_UploadFailureIsRemoteUnavailable(t *testing.T) { } func TestChunkCut_ClosedLayerIsTyped(t *testing.T) { - s, _ := newChunkTestStore(t) + s, _ := newLegacyChunkTestStore(t) layer := mustAttach(t, s, newFakeChunkRemote(), ctConfig(1)) if err := layer.Close(); err != nil { t.Fatal(err) @@ -47,7 +47,7 @@ func TestChunkCut_ClosedLayerIsTyped(t *testing.T) { // A CAS that returned no definite answer, after which HEAD reads a newer // generation from the same holder, did not apply: a head conflict. func TestChunkCut_CASLostToMovedHeadIsHeadConflict(t *testing.T) { - s, _ := newChunkTestStore(t) + s, _ := newLegacyChunkTestStore(t) f := newFakeChunkRemote() layer := mustAttach(t, s, f, ctConfig(1)) w := newWriteLog() diff --git a/seaweed-block/core/storage/chunk_restore_test.go b/seaweed-block/core/storage/chunk_restore_test.go index 115f4e5818..3f201abd3f 100644 --- a/seaweed-block/core/storage/chunk_restore_test.go +++ b/seaweed-block/core/storage/chunk_restore_test.go @@ -137,7 +137,7 @@ func TestClaimChunkHeadFencesNoopCut(t *testing.T) { } func TestFreshRestoreBitmapStartsAtClaimedHEAD(t *testing.T) { - s, _ := newChunkTestStore(t) + s, _ := newLegacyChunkTestStore(t) r := NewMemChunkRemote() if _, err := r.CASHead(ctTimeout(t), ChunkHeadVersion{}, ChunkHead{Epoch: 2, Holder: "host-a", RemoteLSN: 42}); err != nil { t.Fatal(err) diff --git a/seaweed-block/core/storage/chunk_upload_parallel_test.go b/seaweed-block/core/storage/chunk_upload_parallel_test.go index f15df41ec5..c843ccee54 100644 --- a/seaweed-block/core/storage/chunk_upload_parallel_test.go +++ b/seaweed-block/core/storage/chunk_upload_parallel_test.go @@ -11,6 +11,7 @@ import ( func TestChunkUploads_DefaultOverlapsBeforeCAS(t *testing.T) { _, f, l, w := precopyLayer(t, 0, 3) + baselineCAS := f.stats().cas f.mu.Lock() f.putGate = make(chan struct{}) gate := f.putGate @@ -33,7 +34,7 @@ func TestChunkUploads_DefaultOverlapsBeforeCAS(t *testing.T) { } } f.mu.Lock() - if len(f.intents) == 0 || f.casCalls != 0 { + if len(f.intents) == 0 || f.casCalls != baselineCAS { t.Error("overlapping uploads require a durable intent and no root CAS") } f.mu.Unlock() diff --git a/seaweed-block/core/storage/contract_test.go b/seaweed-block/core/storage/contract_test.go index e383930677..9e63b2e04c 100644 --- a/seaweed-block/core/storage/contract_test.go +++ b/seaweed-block/core/storage/contract_test.go @@ -223,6 +223,17 @@ func TestContract_BoundariesReflectWrites(t *testing.T) { func TestContract_ApplyEntryUsesSuppliedLSN(t *testing.T) { runForEachImpl(t, func(t *testing.T, store LogicalStorage) { + if ws, ok := store.(*storage.WALStore); ok && ws.FormatV3() { + // v3 forbids an unanchored jump: establish the source's BASE + // before applying its next supplied LSN, as the receiver does. + h, err := ws.BeginBaseInstall(99, [16]byte{1}) + if err != nil { + t.Fatal(err) + } + if err := h.MarkBaseComplete(); err != nil { + t.Fatal(err) + } + } want := makeBlock(store.BlockSize(), 0xCD) // ApplyEntry is the replication path — the LSN comes from the // source, not from the local allocator. @@ -255,6 +266,18 @@ func TestContract_ApplyEntryUsesSuppliedLSN(t *testing.T) { func TestContract_AdvanceFrontierBumpsH(t *testing.T) { runForEachImpl(t, func(t *testing.T, store LogicalStorage) { store.AdvanceFrontier(50) + if ws, ok := store.(*storage.WALStore); ok && ws.FormatV3() { + if _, _, head := store.Boundaries(); head != 0 { + t.Fatal("v3 allowed an unowned legacy frontier jump") + } + h, err := ws.BeginBaseInstall(50, [16]byte{1}) + if err != nil { + t.Fatal(err) + } + if err := h.MarkBaseComplete(); err != nil { + t.Fatal(err) + } + } _, _, H := store.Boundaries() if H != 50 { t.Fatalf("AdvanceFrontier(50) should set H=50, got %d", H) @@ -344,7 +367,23 @@ func TestContract_WriteExtentDirect(t *testing.T) { } // WriteExtentDirect must succeed and become readable. - if err := store.WriteExtentDirect(3, baseBytes); err != nil { + walLSN := uint64(5) + if ws, ok := store.(*storage.WALStore); ok && ws.FormatV3() { + if err := store.WriteExtentDirect(3, baseBytes); err == nil { + t.Fatal("v3 allowed a direct extent write outside its install handle") + } + h, err := ws.BeginBaseInstall(0, [16]byte{1}) + if err != nil { + t.Fatal(err) + } + if err := h.WriteBase(3, baseBytes); err != nil { + t.Fatal(err) + } + if err := h.MarkBaseComplete(); err != nil { + t.Fatal(err) + } + walLSN = 1 // the first contiguous WAL LSN after BASE0 + } else if err := store.WriteExtentDirect(3, baseBytes); err != nil { t.Fatalf("WriteExtentDirect: %v", err) } got, err := store.Read(3) @@ -370,7 +409,7 @@ func TestContract_WriteExtentDirect(t *testing.T) { // bytes — this matches the recovery flow where WAL frames // at higher LSNs naturally overwrite the BASE snapshot. walBytes := makeBlock(bs, 0xBB) - if err := store.ApplyEntry(3, walBytes, 5); err != nil { + if err := store.ApplyEntry(3, walBytes, walLSN); err != nil { t.Fatalf("ApplyEntry after WriteExtentDirect: %v", err) } got2, err := store.Read(3) @@ -385,8 +424,8 @@ func TestContract_WriteExtentDirect(t *testing.T) { // effect), so H bumped — this is the receiver's existing // side-effect contract for ApplyEntry, unrelated to BASE. _, _, h2 := store.Boundaries() - if h2 < 5 { - t.Errorf("after ApplyEntry(lsn=5) H=%d want >= 5", h2) + if h2 != walLSN { + t.Errorf("after ApplyEntry(lsn=%d) H=%d want %d", walLSN, h2, walLSN) } }) } diff --git a/seaweed-block/core/storage/flusher_instrumentation_test.go b/seaweed-block/core/storage/flusher_instrumentation_test.go index 07e0884e99..72e09025b1 100644 --- a/seaweed-block/core/storage/flusher_instrumentation_test.go +++ b/seaweed-block/core/storage/flusher_instrumentation_test.go @@ -34,7 +34,7 @@ func TestBoundedExtentWriteOpportunity(t *testing.T) { } func TestFlusherInstrumentationCountsCompleteCycle(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } @@ -176,7 +176,7 @@ func TestFlusherInstrumentationCountsCheckpointFailure(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } @@ -291,7 +291,7 @@ func TestFlusherInstrumentationCountsWALReadFailures(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/flusher_snapshot_cut_test.go b/seaweed-block/core/storage/flusher_snapshot_cut_test.go index 981fbc6436..5de0f42e2a 100644 --- a/seaweed-block/core/storage/flusher_snapshot_cut_test.go +++ b/seaweed-block/core/storage/flusher_snapshot_cut_test.go @@ -24,7 +24,7 @@ func TestFlusherSnapshotCutPreservesSyncedWrites(t *testing.T) { } t.Run(name, func(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 128, 4096) + s, err := createLegacyWALStoreForTest(path, 128, 4096) if err != nil { t.Fatal(err) } @@ -127,7 +127,7 @@ func TestFlusherSnapshotCutPreservesSyncedWrites(t *testing.T) { t.Fatal(err) } crashed = true - reopened, err := OpenWALStore(path) + reopened, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/flusher_test.go b/seaweed-block/core/storage/flusher_test.go index 0b1ee0e075..9155b34594 100644 --- a/seaweed-block/core/storage/flusher_test.go +++ b/seaweed-block/core/storage/flusher_test.go @@ -16,7 +16,7 @@ func TestFlusher_AdvancesCheckpointBeforeReadFromExtent(t *testing.T) { dir := t.TempDir() path := filepath.Join(dir, "store.bin") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -69,7 +69,7 @@ func TestFlusher_ReleasesWALPressureAfterCheckpoint(t *testing.T) { dir := t.TempDir() path := filepath.Join(dir, "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 128, 4096, 256*1024) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 128, 4096, 256*1024) defer s.Close() for i := uint32(0); i < 32; i++ { @@ -130,7 +130,7 @@ func TestWALWriter_AdvanceTailPastWrappedEntry(t *testing.T) { } } -func createWALStoreWithWALSizeForTest(t *testing.T, path string, numBlocks uint32, blockSize int, walSize uint64) *WALStore { +func createLegacyWALStoreWithWALSizeForTest(t *testing.T, path string, numBlocks uint32, blockSize int, walSize uint64) *WALStore { t.Helper() if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { t.Fatalf("mkdir: %v", err) @@ -144,7 +144,7 @@ func createWALStoreWithWALSizeForTest(t *testing.T, path string, numBlocks uint3 ExtentSize: uint32(blockSize), WALSize: walSize, ImplKind: ImplKindWALStore, - ImplVersion: WALStoreImplVersion, + ImplVersion: 1, // frozen v2 engine fixture, not the production selector }) if err != nil { _ = f.Close() @@ -180,7 +180,7 @@ func TestFlusher_RecoveryHonorsCheckpoint(t *testing.T) { path := filepath.Join(dir, "store.bin") { - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -204,7 +204,7 @@ func TestFlusher_RecoveryHonorsCheckpoint(t *testing.T) { // Reopen + Recover. The checkpointed records should be skipped; // extent should serve all reads. - s, err := OpenWALStore(path) + s, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -273,7 +273,7 @@ func TestCrashFamily_AbruptKillAtMultipleWindows(t *testing.T) { path := filepath.Join(dir, "store.bin") func() { - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -313,7 +313,7 @@ func TestCrashFamily_AbruptKillAtMultipleWindows(t *testing.T) { // Reopen + Recover. Verify acked survives, unacked // is either present-as-written or absent, never corrupt. - s, err := OpenWALStore(path) + s, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatalf("reopen after %s: %v", c.name, err) } @@ -373,7 +373,7 @@ func TestFlusher_ManyDirtyEntriesCheckpointStaysCorrect(t *testing.T) { const n = 300 // > any plausible old maxBatch (which was 256) { - s, err := CreateWALStore(path, n+10, 4096) + s, err := createLegacyWALStoreForTest(path, n+10, 4096) if err != nil { t.Fatal(err) } @@ -409,7 +409,7 @@ func TestFlusher_ManyDirtyEntriesCheckpointStaysCorrect(t *testing.T) { // Reopen + Recover. Every LBA must be readable with the bytes // we wrote — the checkpoint advance must have only covered // LBAs whose data is actually in the extent. - s, err := OpenWALStore(path) + s, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -448,7 +448,7 @@ func TestFlusher_ConcurrentWriteRaceLBAStaysFresh(t *testing.T) { dir := t.TempDir() path := filepath.Join(dir, "store.bin") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -502,7 +502,7 @@ func TestAllBlocks_ReturnsBlocksAfterFlush(t *testing.T) { dir := t.TempDir() path := filepath.Join(dir, "store.bin") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -553,7 +553,7 @@ func TestRecovery_DeterministicAcrossMultipleOpens(t *testing.T) { path := filepath.Join(dir, "store.bin") { - s, _ := CreateWALStore(path, 16, 4096) + s, _ := createLegacyWALStoreForTest(path, 16, 4096) for i := uint32(0); i < 5; i++ { _, _ = s.Write(i, makeBlock(4096, byte(0x10+i))) } @@ -565,7 +565,7 @@ func TestRecovery_DeterministicAcrossMultipleOpens(t *testing.T) { } // First reopen + Recover. - s1, _ := OpenWALStore(path) + s1, _ := openLegacyWALStoreForTest(path) r1, err := s1.Recover() if err != nil { t.Fatal(err) @@ -577,7 +577,7 @@ func TestRecovery_DeterministicAcrossMultipleOpens(t *testing.T) { _ = s1.Close() // Second reopen + Recover on the same file. - s2, _ := OpenWALStore(path) + s2, _ := openLegacyWALStoreForTest(path) r2, err := s2.Recover() if err != nil { t.Fatal(err) diff --git a/seaweed-block/core/storage/format_v3_test_support.go b/seaweed-block/core/storage/format_v3_test_support.go index ad932eae5c..1e7de35b79 100644 --- a/seaweed-block/core/storage/format_v3_test_support.go +++ b/seaweed-block/core/storage/format_v3_test_support.go @@ -125,3 +125,12 @@ func DamageV3RecordTest(path string, lsn uint64) error { } return fmt.Errorf("no v3 record with LSN %d", lsn) } + +// Legacy fixtures only; unavailable in production builds. +// TODO(format-v3 row 14a): replace with captured migration fixtures. +func CreateLegacyWALStoreTest(path string, blocks uint32, blockSize int) (*WALStore, error) { + return createLegacyWALStoreWithOptions(path, blocks, blockSize, WALStoreOptions{}) +} +func OpenLegacyWALStoreTest(path string) (*WALStore, error) { + return openLegacyWALStoreWithOptions(path, WALStoreOptions{}) +} diff --git a/seaweed-block/core/storage/legacy_fixture_isolation_test.go b/seaweed-block/core/storage/legacy_fixture_isolation_test.go new file mode 100644 index 0000000000..9b1d11728a --- /dev/null +++ b/seaweed-block/core/storage/legacy_fixture_isolation_test.go @@ -0,0 +1,75 @@ +package storage + +import ( + "context" + "encoding/json" + "go/ast" + "go/parser" + "go/token" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" + "time" +) + +// The old engine remains only for explicit fixtures until row 14a. The +// production import closure must not bring in its frozen tool/test package, +// and no production source may call the legacy constructor chain. +func TestLegacyFixtureIsolation(t *testing.T) { + entries, err := os.ReadDir(".") + if err != nil { + t.Fatal(err) + } + forbidden := map[string]bool{"createLegacyWALStoreWithOptions": true, "openLegacyWALStoreWithOptions": true, "openLegacyReadOnlyWithOptions": true} + for _, e := range entries { + n := e.Name() + if e.IsDir() || !strings.HasSuffix(n, ".go") || strings.HasSuffix(n, "_test.go") || n == "format_v3_test_support.go" { + continue + } + f, err := parser.ParseFile(token.NewFileSet(), n, nil, 0) + if err != nil { + t.Fatal(err) + } + ast.Inspect(f, func(n ast.Node) bool { + call, ok := n.(*ast.CallExpr) + if !ok { + return true + } + id, ok := call.Fun.(*ast.Ident) + if ok && forbidden[id.Name] { + t.Errorf("production source %s calls legacy fixture %s", e.Name(), id.Name) + } + return true + }) + } + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + cmd := exec.CommandContext(ctx, "go", "list", "-deps", "-json", "./core/storage") + cmd.Dir = filepath.Join("..", "..") + out, err := cmd.Output() + if err != nil { + t.Fatalf("default production transitive import graph: %v", err) + } + dec := json.NewDecoder(strings.NewReader(string(out))) + for dec.More() { + var p struct { + ImportPath string + GoFiles []string + } + if err := dec.Decode(&p); err != nil { + t.Fatal(err) + } + if strings.Contains(p.ImportPath, "/internal/v2legacy") { + t.Errorf("unexpected frozen import %s", p.ImportPath) + } + if p.ImportPath == "github.com/seaweedfs/seaweed-block/core/storage" { + for _, n := range p.GoFiles { + if n == "format_v3_test_support.go" { + t.Fatal("test constructors entered default production import closure") + } + } + } + } +} diff --git a/seaweed-block/core/storage/legacy_fixture_test.go b/seaweed-block/core/storage/legacy_fixture_test.go new file mode 100644 index 0000000000..1efabc06c8 --- /dev/null +++ b/seaweed-block/core/storage/legacy_fixture_test.go @@ -0,0 +1,14 @@ +package storage + +// TODO(format-v3 row 14a): relocate or retire only the inventory-listed v2 +// engine controls after the named v3 replacements and migration receipts pass. +// These explicit fixture constructors are never production selectors. +func createLegacyWALStoreForTest(path string, blocks uint32, blockSize int) (*WALStore, error) { + return createLegacyWALStoreWithOptions(path, blocks, blockSize, WALStoreOptions{}) +} +func openLegacyWALStoreForTest(path string) (*WALStore, error) { + return openLegacyWALStoreWithOptions(path, WALStoreOptions{}) +} +func openLegacyReadOnlyForTest(path string) (*WALStoreReader, error) { + return openLegacyReadOnlyWithOptions(path, WALStoreOptions{}) +} diff --git a/seaweed-block/core/storage/superblock.go b/seaweed-block/core/storage/superblock.go index 0fad23bf38..9880437d39 100644 --- a/seaweed-block/core/storage/superblock.go +++ b/seaweed-block/core/storage/superblock.go @@ -10,11 +10,10 @@ import ( // File-format identity. Bumped only on incompatible layout changes. // -// Version history: -// 1: initial layout (magic+version+geometry+WAL state+CreatedAt) -// 2: T3a Addendum A — added ImplKind + ImplVersion at end of -// layout. Opening a v1 store with v2 code returns -// errSuperblockBadVer (one-way bump; no compat read path). +// Version 1 used magic, version, geometry, WAL state and CreatedAt. +// Version 2 (T3a Addendum A) added ImplKind and ImplVersion. Opening +// a v1 store with v2 code returns errSuperblockBadVer; there is no +// compatible read path. const ( superblockSize = 4096 superblockMagic = "SWBK" @@ -40,7 +39,7 @@ const ( // files. Independent from superblockVersion (which is the shared // superblock-format version) — walstore and smartwal evolve their // WAL+extent layouts on independent clocks. -const WALStoreImplVersion uint32 = 1 +const WALStoreImplVersion uint32 = 3 var ( errSuperblockNotOurs = errors.New("storage: not a store file (bad magic)") diff --git a/seaweed-block/core/storage/superblock_v3.go b/seaweed-block/core/storage/superblock_v3.go index 17d4e281b0..b7d3e7ffc3 100644 --- a/seaweed-block/core/storage/superblock_v3.go +++ b/seaweed-block/core/storage/superblock_v3.go @@ -14,9 +14,8 @@ import ( // A v3 file holds two 4096-byte descriptor slots, A at offset 0 and B at // 4096; the WAL starts at 8192. Each slot is one complete generation // descriptor sealed by a CRC32C (Castagnoli). This file holds only the -// slot codec, its validity rules and the A/B selection. It is not reached -// by any production open or create path until the activation commit; v2 -// files keep using superblock.go unchanged. +// slot codec, its validity rules and the production A/B selection. Legacy +// decoding is retained for the explicit offline migration boundary. const ( slotSizeV3 = 4096 diff --git a/seaweed-block/core/storage/volume_lock_v3_test.go b/seaweed-block/core/storage/volume_lock_v3_test.go index 9613a3561c..c685576730 100644 --- a/seaweed-block/core/storage/volume_lock_v3_test.go +++ b/seaweed-block/core/storage/volume_lock_v3_test.go @@ -15,7 +15,7 @@ func TestWALStoreV3OwnerExcludesOpenAndReadOnly(t *testing.T) { } t.Fatalf("second writable owner: %v", err) } - if reader, err := openReadOnlyV3ForTest(path, WALStoreOptions{}); !errors.Is(err, ErrWALStoreLocked) { + if reader, err := openReadOnlyV3(path, WALStoreOptions{}); !errors.Is(err, ErrWALStoreLocked) { if reader != nil { _ = reader.Close() } @@ -24,7 +24,7 @@ func TestWALStoreV3OwnerExcludesOpenAndReadOnly(t *testing.T) { if err := s.Close(); err != nil { t.Fatal(err) } - reader, err := openReadOnlyV3ForTest(path, WALStoreOptions{}) + reader, err := openReadOnlyV3(path, WALStoreOptions{}) if err != nil { t.Fatal(err) } @@ -51,7 +51,7 @@ func TestWALStoreV3CreatorKeepsOwnershipThroughPublication(t *testing.T) { } t.Errorf("creation published=%v writable contender: %v", published, err) } - if other, err := openReadOnlyV3ForTest(path, WALStoreOptions{}); !errors.Is(err, ErrWALStoreLocked) { + if other, err := openReadOnlyV3(path, WALStoreOptions{}); !errors.Is(err, ErrWALStoreLocked) { if other != nil { _ = other.Close() } diff --git a/seaweed-block/core/storage/wal_entry_v3.go b/seaweed-block/core/storage/wal_entry_v3.go index 9d1401d51c..b0f4a70aa9 100644 --- a/seaweed-block/core/storage/wal_entry_v3.go +++ b/seaweed-block/core/storage/wal_entry_v3.go @@ -5,6 +5,7 @@ import ( "fmt" "hash/crc32" "math" + "time" ) // The impl-3 codec is deliberately separate from the 38-byte impl-1 codec. @@ -98,6 +99,11 @@ func (e walEntryV3) payloadSizeV3(blockSize uint32, numBlocks uint64) (uint64, e } func encodeWALEntryV3(e walEntryV3, blockSize uint32, numBlocks uint64) ([]byte, error) { + return encodeWALEntryV3Instrumented(e, blockSize, numBlocks, nil) +} + +func encodeWALEntryV3Instrumented(e walEntryV3, blockSize uint32, numBlocks uint64, instr *writeInstrumentation) ([]byte, error) { + start := time.Now() n, err := e.payloadSizeV3(blockSize, numBlocks) if err != nil { return nil, err @@ -124,9 +130,20 @@ func encodeWALEntryV3(e walEntryV3, blockSize uint32, numBlocks uint64) ([]byte, le.PutUint64(buf[38:46], e.LogicalStart) copy(buf[46:62], e.Nonce[:]) end := walEntryPrefixSizeV3 + int(n) + copyStart := time.Now() copy(buf[walEntryPrefixSizeV3:end], e.Data) + if instr != nil { + instr.recordWALCopy(len(e.Data), time.Since(copyStart)) + } + checksumStart := time.Now() le.PutUint32(buf[end:end+4], crc32.Checksum(buf[:end], walEntryCRC32CV3)) + if instr != nil { + instr.recordWALChecksum(end, time.Since(checksumStart)) + } le.PutUint32(buf[end+4:end+8], uint32(len(buf))) + if instr != nil { + instr.recordWALEncode(len(buf), time.Since(start)) + } return buf, nil } diff --git a/seaweed-block/core/storage/wal_io_v3.go b/seaweed-block/core/storage/wal_io_v3.go index c0d1f6bced..59a05ffd2c 100644 --- a/seaweed-block/core/storage/wal_io_v3.go +++ b/seaweed-block/core/storage/wal_io_v3.go @@ -9,6 +9,7 @@ import ( "os" "sort" "sync" + "time" ) var errWALBindingV3 = errors.New("storage: v3 WAL nonce/cursor binding refused") @@ -42,6 +43,7 @@ type walWriterV3 struct { // Volatile record boundaries, never payloads. Recovery reconstructs // only the trusted kept prefix; a batch is one indivisible point. reclaim []walReclaimPointV3 + instr *writeInstrumentation } type walReclaimPointV3 struct{ lastLSN, end uint64 } @@ -64,7 +66,11 @@ func (w *walWriterV3) append(e walEntryV3, durableLSN uint64) (uint64, error) { // Descriptor snapshot precedes the writer lock. A concurrent floor advance // makes this snapshot conservative; reset must quiesce/recreate the writer. d, floor, ok := w.pub.walSnapshotV3() + lockStart := time.Now() w.mu.Lock() + if w.instr != nil { + w.instr.recordWALAppendLockWait(time.Since(lockStart)) + } defer w.mu.Unlock() if w.failed != nil { return 0, w.failed @@ -113,7 +119,7 @@ func (w *walWriterV3) append(e walEntryV3, durableLSN uint64) (uint64, error) { } start := w.head + gap e.LogicalStart = start - buf, err := encodeWALEntryV3(e, d.BlockSize, d.VolumeSize/uint64(d.BlockSize)) + buf, err := encodeWALEntryV3Instrumented(e, d.BlockSize, d.VolumeSize/uint64(d.BlockSize), w.instr) if err != nil { return 0, err } @@ -128,7 +134,11 @@ func (w *walWriterV3) append(e walEntryV3, durableLSN uint64) (uint64, error) { } } write := func(b []byte, pos uint64) error { + start := time.Now() n, err := w.writeAt(b, int64(d.WALOffset+pos%d.WALSize)) + if w.instr != nil { + w.instr.recordWALAppend(n, time.Since(start)) + } if err == nil && n != len(b) { err = io.ErrShortWrite } @@ -143,6 +153,9 @@ func (w *walWriterV3) append(e walEntryV3, durableLSN uint64) (uint64, error) { return 0, err } } + if gap > 0 && w.instr != nil { + w.instr.recordWALAppendWrap(gap) + } // A suffix shorter than 70 is skipped geometrically, never decoded as a record. if err := write(buf, start); err != nil { return 0, err @@ -262,8 +275,14 @@ type walScanResultV3 struct { } func scanWALV3(fd *os.File, d descriptorV3) (walScanResultV3, error) { + return scanWALV3Accepted(fd, d, nil) +} + +// Only an already-bound metadata factory can authorize a companion format. +// Standalone scans retain the OSS-only discriminator check. +func scanWALV3Accepted(fd *os.File, d descriptorV3, accept slotImplAcceptor) (walScanResultV3, error) { r := walScanResultV3{Nonce: d.Nonce} - if err := d.validate(nil); err != nil { + if err := d.validate(accept); err != nil { return r, err } info, err := fd.Stat() diff --git a/seaweed-block/core/storage/walstore.go b/seaweed-block/core/storage/walstore.go index b01e7edda1..6c804f1d8b 100644 --- a/seaweed-block/core/storage/walstore.go +++ b/seaweed-block/core/storage/walstore.go @@ -135,8 +135,8 @@ type WALStore struct { // gates and mounted NVMe/TCP profiling pass. multiBlockRecords bool - // v3 is non-nil for a format-v3 store (walstore_v3.go). Dark until - // activation: only createWALStoreV3ForTest/openWALStoreV3ForTest set it. + // v3 is non-nil for a format-v3 store (walstore_v3.go). Production + // selectors use v3; legacy formats require explicit offline migration. v3 *walStoreV3State // Physical WAL sync attempts exclude the separate metadata/checkpoint syncs. @@ -178,6 +178,25 @@ func CreateWALStore(path string, numBlocks uint32, blockSize int) (*WALStore, er } func CreateWALStoreWithOptions(path string, numBlocks uint32, blockSize int, opts WALStoreOptions) (*WALStore, error) { + if blockSize == 0 { + blockSize = DefaultBlockSize + } + if blockSize < 0 || uint64(blockSize) > uint64(^uint32(0)) { + return nil, errSuperblockBadVolume + } + if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { + return nil, err + } + cb := opts.ChunkBlocks + if cb == 0 { + cb = 1024 + } + return createWALStoreV3Configured(path, numBlocks, uint32(blockSize), 64*1024*1024, opts.WMode, 0, uint64(cb), opts) +} + +// Frozen constructor for legacy-format regression fixtures; public Create +// never reaches it after activation. Removed from production in row 14a. +func createLegacyWALStoreWithOptions(path string, numBlocks uint32, blockSize int, opts WALStoreOptions) (*WALStore, error) { if blockSize == 0 { blockSize = DefaultBlockSize } @@ -194,7 +213,7 @@ func CreateWALStoreWithOptions(path string, numBlocks uint32, blockSize int, opt BlockSize: uint32(blockSize), ExtentSize: uint32(blockSize), // one block per extent slot keeps math trivial ImplKind: ImplKindWALStore, - ImplVersion: WALStoreImplVersion, + ImplVersion: 1, }) if err != nil { _ = f.Close() @@ -233,6 +252,10 @@ func OpenWALStore(path string) (*WALStore, error) { } func OpenWALStoreWithOptions(path string, opts WALStoreOptions) (*WALStore, error) { + return openWALStoreV3WithOptions(path, true, opts) +} + +func openLegacyWALStoreWithOptions(path string, opts WALStoreOptions) (*WALStore, error) { f, err := os.OpenFile(path, os.O_RDWR, 0o644) if err != nil { return nil, fmt.Errorf("storage: open %s: %w", path, err) diff --git a/seaweed-block/core/storage/walstore_activation_test.go b/seaweed-block/core/storage/walstore_activation_test.go new file mode 100644 index 0000000000..5b38a839ba --- /dev/null +++ b/seaweed-block/core/storage/walstore_activation_test.go @@ -0,0 +1,158 @@ +package storage + +import ( + "bytes" + "errors" + "fmt" + "os" + "path/filepath" + "testing" +) + +func TestWALStoreProductionSelectorCreatesMappedV3(t *testing.T) { + path := filepath.Join(t.TempDir(), "volume") + s, err := CreateWALStore(path, 64, 4096) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = s.Close() }) + if !s.FormatV3() { + t.Fatal("production Create must select mapped v3/impl3") + } + d := s.v3.pub.current() + if d.ImplVersion != 3 || d.WMode != WModeLagged || d.MapRootHash == [32]byte{} { + t.Fatalf("production descriptor: impl=%d mode=%d map=%x", d.ImplVersion, d.WMode, d.MapRootHash) + } + if _, err := s.Write(3, bytes.Repeat([]byte{0x73}, 4096)); err != nil { + t.Fatal(err) + } + if _, err := s.Sync(); err != nil { + t.Fatal(err) + } + if err := s.Close(); err != nil { + t.Fatal(err) + } + r, err := OpenWALStore(path) + if err != nil { + t.Fatal(err) + } + if _, err := r.Recover(); err != nil { + _ = r.Close() + t.Fatal(err) + } + if err := r.Close(); err != nil { + t.Fatal(err) + } + ro, err := OpenReadOnly(path) + if err != nil { + t.Fatal(err) + } + defer ro.Close() + if data, err := ro.Read(3); err != nil || !bytes.Equal(data, bytes.Repeat([]byte{0x73}, 4096)) { + t.Fatalf("production readonly after reopen: %v", err) + } +} + +func TestWALStoreProductionFallsBackWhenDamagedSlotOnlyLooksLegacy(t *testing.T) { + path := filepath.Join(t.TempDir(), "volume") + s, err := CreateWALStore(path, 16, 4096) + if err != nil { + t.Fatal(err) + } + if _, err := s.Write(3, blk(0x73)); err != nil { + t.Fatal(err) + } + if _, err := s.Sync(); err != nil { + t.Fatal(err) + } + if err := s.Close(); err != nil { + t.Fatal(err) + } + f, err := os.OpenFile(path, os.O_RDWR, 0) + if err != nil { + t.Fatal(err) + } + _, err = f.WriteAt([]byte{2, 0}, 4) // corrupt A's discriminator, not a valid v2 header + ce := f.Close() + if err != nil || ce != nil { + t.Fatal(err, ce) + } + r, err := OpenWALStore(path) + if err != nil { + t.Fatalf("valid B was masked by a damaged v3 A: %v", err) + } + defer r.Close() + if _, err := r.Recover(); err != nil { + t.Fatal(err) + } + if got, err := r.Read(3); err != nil || !bytes.Equal(got, blk(0x73)) { + t.Fatalf("fallback bytes: %v", err) + } +} + +func TestWALStoreProductionRefusesLegacyWithoutMutation(t *testing.T) { + for _, version := range []uint32{1, 2} { + t.Run(fmt.Sprint(version), func(t *testing.T) { + path := filepath.Join(t.TempDir(), "legacy") + opts := WALStoreOptions{} + if version == 2 { + opts = recordingOptions(&recordingMetadata{}, 2) + } + s, err := createLegacyWALStoreWithOptions(path, 16, 4096, opts) + if err != nil { + t.Fatal(err) + } + if err := s.Close(); err != nil { + t.Fatal(err) + } + before, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + if r, err := OpenWALStore(path); !errors.Is(err, ErrUnsupportedLegacyFormat) { + if r != nil { + _ = r.Close() + } + t.Fatalf("legacy writable open: %v", err) + } + if r, err := OpenReadOnly(path); !errors.Is(err, ErrUnsupportedLegacyFormat) { + if r != nil { + _ = r.Close() + } + t.Fatalf("legacy readonly open: %v", err) + } + after, err := os.ReadFile(path) + if err != nil || !bytes.Equal(before, after) { + t.Fatal("legacy refusal changed bytes", err) + } + }) + } +} + +func TestWALStoreProductionCreateOptions(t *testing.T) { + s, err := CreateWALStoreWithOptions(filepath.Join(t.TempDir(), "volume"), 64, 4096, WALStoreOptions{ChunkBlocks: 4, WMode: WModeStrict}) + if err != nil { + t.Fatal(err) + } + defer s.Close() + if s.v3.pub.current().WMode != WModeStrict || s.v3.ownedMap.chunkBlocks != 4 || len(s.v3.mapEntries) != 16 { + t.Fatal("production create lost the strict mode or map geometry option") + } +} + +func TestWALStoreV3InstrumentationIncludesBatch(t *testing.T) { + s, _ := newMappedCheckpointStoreV3(t) + if _, err := s.Write(0, blk(1)); err != nil { + t.Fatal(err) + } + if _, err := s.WriteBatch(2, [][]byte{blk(2), blk(3)}); err != nil { + t.Fatal(err) + } + i := s.WriteInstrumentation() + // A batch first aggregates its blocks, then copies that payload into + // the encoded frame: both real copies belong in the cost profile. + if i.WALCopyOps != 3 || i.WALCopyBytes != 5*4096 || i.WALEncodeOps != 2 || i.WALChecksumOps != 2 || + i.WALAppendOps != 2 || i.WALAppendWriteAtCalls != 2 || i.DirtyMapUpdateOps != 3 || s.DurabilityLatency().WALAppend.Count != 2 { + t.Fatalf("v3 single+8KiB batch instrumentation incomplete: %+v latency=%+v", i, s.DurabilityLatency()) + } +} diff --git a/seaweed-block/core/storage/walstore_batch_lsn_reuse_test.go b/seaweed-block/core/storage/walstore_batch_lsn_reuse_test.go index a98d4f3f33..a10bc21bb0 100644 --- a/seaweed-block/core/storage/walstore_batch_lsn_reuse_test.go +++ b/seaweed-block/core/storage/walstore_batch_lsn_reuse_test.go @@ -18,7 +18,7 @@ import ( func TestWALStoreFailedBatchAppendDoesNotRevertALaterAckedWrite(t *testing.T) { const blockSize = 4096 path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, blockSize, 64*1024) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, blockSize, 64*1024) s.DisableAutoFlushForRecoveryTest() crashed := false t.Cleanup(func() { @@ -80,7 +80,7 @@ func TestWALStoreFailedBatchAppendDoesNotRevertALaterAckedWrite(t *testing.T) { func reopenForB5(t *testing.T, path string) *WALStore { t.Helper() - r, err := OpenWALStore(path) + r, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/walstore_batch_v3_test.go b/seaweed-block/core/storage/walstore_batch_v3_test.go index 0590633c3e..1bd91b7e2d 100644 --- a/seaweed-block/core/storage/walstore_batch_v3_test.go +++ b/seaweed-block/core/storage/walstore_batch_v3_test.go @@ -213,7 +213,7 @@ func TestWALStoreV3ReadOnlyReaderServesBatchBlocks(t *testing.T) { t.Fatal(err) } crashRecoveryHardeningStore(t, s) - reader, err := openReadOnlyV3ForTest(path, WALStoreOptions{}) + reader, err := openReadOnlyV3(path, WALStoreOptions{}) if err != nil { t.Fatalf("readonly open: %v", err) } diff --git a/seaweed-block/core/storage/walstore_checkpoint_crash_linux_test.go b/seaweed-block/core/storage/walstore_checkpoint_crash_linux_test.go index 08877a68ad..86add171e5 100644 --- a/seaweed-block/core/storage/walstore_checkpoint_crash_linux_test.go +++ b/seaweed-block/core/storage/walstore_checkpoint_crash_linux_test.go @@ -44,7 +44,7 @@ func TestWALStoreCheckpointSIGKILLCrashWindows(t *testing.T) { t.Fatalf("crash helper returned normally: %s", output) } - reopened, err := OpenWALStore(path) + reopened, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -69,7 +69,7 @@ func TestWALStoreCheckpointSIGKILLCrashWindows(t *testing.T) { } func runCheckpointCrashHelper(window, path string) { - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { panic(err) } diff --git a/seaweed-block/core/storage/walstore_checkpoint_safety_test.go b/seaweed-block/core/storage/walstore_checkpoint_safety_test.go index 166cdf1312..86b6ce18f3 100644 --- a/seaweed-block/core/storage/walstore_checkpoint_safety_test.go +++ b/seaweed-block/core/storage/walstore_checkpoint_safety_test.go @@ -34,7 +34,7 @@ func TestFlusherCheckpointMetadataFailureDoesNotPublishOrRecycle(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } @@ -145,7 +145,7 @@ func TestCheckpointPublicationCrashWindowsRemainRecoverable(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -173,7 +173,7 @@ func TestCheckpointPublicationCrashWindowsRemainRecoverable(t *testing.T) { } s.fd = nil - reopened, err := OpenWALStore(path) + reopened, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -198,7 +198,7 @@ func TestCheckpointPublicationCrashWindowsRemainRecoverable(t *testing.T) { } func TestFlusherWALSlotMismatchFailsClosed(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } @@ -280,7 +280,7 @@ func TestFlusherRejectsCorruptOrUnsupportedDirtyRecord(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } @@ -337,7 +337,7 @@ func TestFlusherRejectsCorruptOrUnsupportedDirtyRecord(t *testing.T) { func TestWALStoreClosePerformsFinalFlush(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -352,7 +352,7 @@ func TestWALStoreClosePerformsFinalFlush(t *testing.T) { t.Fatal(err) } - reopened, err := OpenWALStore(path) + reopened, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -373,7 +373,7 @@ func TestWALStoreClosePerformsFinalFlush(t *testing.T) { } func TestWALStoreCloseWaitsForInflightSync(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } @@ -414,7 +414,7 @@ func TestWALStoreCloseWaitsForInflightSync(t *testing.T) { } func TestWALStoreMutationAPIsRejectAfterClose(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } @@ -454,7 +454,7 @@ func TestWALStoreCloseReturnsFinalMetadataFailure(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } @@ -475,7 +475,7 @@ func TestWALStoreCloseReturnsFinalMetadataFailure(t *testing.T) { } func TestWriteExtentDirectSupersedesPriorDirtyWAL(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } @@ -503,7 +503,7 @@ func TestWriteExtentDirectSupersedesPriorDirtyWAL(t *testing.T) { func TestWriteExtentDirectSupersededWALDoesNotReappearAfterRestart(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -527,7 +527,7 @@ func TestWriteExtentDirectSupersededWALDoesNotReappearAfterRestart(t *testing.T) t.Fatal(err) } - reopened, err := OpenWALStore(path) + reopened, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -545,7 +545,7 @@ func TestWriteExtentDirectSupersededWALDoesNotReappearAfterRestart(t *testing.T) } func TestRunningFlusherCannotOverwriteDirectBase(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } @@ -572,7 +572,7 @@ func TestRunningFlusherCannotOverwriteDirectBase(t *testing.T) { } func TestFlusherSnapshotCannotOverwriteLaterDirectBase(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } @@ -609,7 +609,7 @@ func TestFlusherSnapshotCannotOverwriteLaterDirectBase(t *testing.T) { } func TestWriteExtentDirectFailureRetainsDirtyWAL(t *testing.T) { - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) + s, err := createLegacyWALStoreForTest(filepath.Join(t.TempDir(), "store.bin"), 16, 4096) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/walstore_format_admission_test.go b/seaweed-block/core/storage/walstore_format_admission_test.go index 98a6a86bc5..f984c47264 100644 --- a/seaweed-block/core/storage/walstore_format_admission_test.go +++ b/seaweed-block/core/storage/walstore_format_admission_test.go @@ -8,7 +8,7 @@ import ( func TestWALStore_UnknownFormatWithoutFactoryRefused(t *testing.T) { path := filepath.Join(t.TempDir(), "store") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -33,11 +33,11 @@ func TestWALStore_UnknownFormatWithoutFactoryRefused(t *testing.T) { if err = f.Close(); err != nil { t.Fatal(err) } - if x, err := OpenWALStore(path); err == nil { + if x, err := openLegacyWALStoreForTest(path); err == nil { x.Close() t.Fatal("unknown format opened without accepting factory") } - if x, err := OpenReadOnly(path); err == nil { + if x, err := openLegacyReadOnlyForTest(path); err == nil { x.Close() t.Fatal("unknown format readonly opened without accepting factory") } diff --git a/seaweed-block/core/storage/walstore_legacy_trim_test.go b/seaweed-block/core/storage/walstore_legacy_trim_test.go index 608be710ec..4ea34da5e1 100644 --- a/seaweed-block/core/storage/walstore_legacy_trim_test.go +++ b/seaweed-block/core/storage/walstore_legacy_trim_test.go @@ -14,7 +14,7 @@ func TestWALStoreRecoverReplaysLegacyRangeTrim(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") func() { - s, err := CreateWALStore(path, 16, blockSize) + s, err := createLegacyWALStoreForTest(path, 16, blockSize) if err != nil { t.Fatal(err) } @@ -47,7 +47,7 @@ func TestWALStoreRecoverReplaysLegacyRangeTrim(t *testing.T) { crashRecoveryHardeningStore(t, s) }() - reader, err := OpenReadOnly(path) + reader, err := openLegacyReadOnlyForTest(path) if err != nil { t.Fatal(err) } @@ -64,7 +64,7 @@ func TestWALStoreRecoverReplaysLegacyRangeTrim(t *testing.T) { t.Fatal(err) } - s, err := OpenWALStore(path) + s, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/walstore_midhistory_hole_test.go b/seaweed-block/core/storage/walstore_midhistory_hole_test.go index df2663e676..4f326ef58f 100644 --- a/seaweed-block/core/storage/walstore_midhistory_hole_test.go +++ b/seaweed-block/core/storage/walstore_midhistory_hole_test.go @@ -18,7 +18,7 @@ func writeSyncedEntries(t *testing.T, lbas []uint32) (*WALStore, string, map[uin t.Helper() const blockSize = 4096 path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 16, blockSize) + s, err := createLegacyWALStoreForTest(path, 16, blockSize) if err != nil { t.Fatal(err) } @@ -60,7 +60,7 @@ func flipDataByte(t *testing.T, s *WALStore, walOffset uint64) { func reopenAfterCrash(t *testing.T, s *WALStore, path string) (*WALStore, uint64, error) { t.Helper() crashRecoveryHardeningStore(t, s) - r, err := OpenWALStore(path) + r, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -143,7 +143,7 @@ func TestWALStoreRecoverWrappedHoleIsNoOutage(t *testing.T) { walSize = 24 * 1024 ) path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, blockSize, walSize) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, blockSize, walSize) s.DisableAutoFlushForRecoveryTest() for lba := uint32(0); lba < 3; lba++ { if _, err := s.Write(lba, makeBlock(blockSize, byte(0x10+lba))); err != nil { diff --git a/seaweed-block/core/storage/walstore_multiblock_profile_test.go b/seaweed-block/core/storage/walstore_multiblock_profile_test.go index c0887fba00..58406f7231 100644 --- a/seaweed-block/core/storage/walstore_multiblock_profile_test.go +++ b/seaweed-block/core/storage/walstore_multiblock_profile_test.go @@ -21,7 +21,7 @@ func TestWALStore_MultiBlockProfile_RecordCountReduction(t *testing.T) { run := func(t *testing.T, multiblock bool) profile { t.Helper() path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, numBlocks, blockSize) + s, err := createLegacyWALStoreForTest(path, numBlocks, blockSize) if err != nil { t.Fatalf("CreateWALStore: %v", err) } diff --git a/seaweed-block/core/storage/walstore_multiblock_test.go b/seaweed-block/core/storage/walstore_multiblock_test.go index 01254e5a8f..b615b937cc 100644 --- a/seaweed-block/core/storage/walstore_multiblock_test.go +++ b/seaweed-block/core/storage/walstore_multiblock_test.go @@ -42,7 +42,7 @@ func TestWALMultiBlock_EncodeDecode(t *testing.T) { func TestWALStore_MultiBlockFeatureDisabledByDefault(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -81,7 +81,7 @@ func TestWALStore_MultiBlockFeatureDisabledByDefault(t *testing.T) { func TestWALStore_MultiBlockDirtyRead(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -127,7 +127,7 @@ func TestWALStore_MultiBlockDirtyRead(t *testing.T) { func TestWALStore_MultiBlockRecoverSplitsPerBlock(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") func() { - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -147,7 +147,7 @@ func TestWALStore_MultiBlockRecoverSplitsPerBlock(t *testing.T) { _ = s.fd.Close() }() - s, err := OpenWALStore(path) + s, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -176,7 +176,7 @@ func TestWALStore_DisableAutoFlushForRecoveryTestPreservesReplayAfterCrash(t *te } func() { - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -197,7 +197,7 @@ func TestWALStore_DisableAutoFlushForRecoveryTestPreservesReplayAfterCrash(t *te } }() - s, err := OpenWALStore(path) + s, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -230,7 +230,7 @@ func TestWALStore_MultiBlockRecoveryHeadLSNUsesRecoveredFrontier(t *testing.T) { var persistedWALHeadBytes uint64 func() { - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -255,7 +255,7 @@ func TestWALStore_MultiBlockRecoveryHeadLSNUsesRecoveredFrontier(t *testing.T) { } }() - s, err := OpenWALStore(path) + s, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -278,7 +278,7 @@ func TestWALStore_MultiBlockRecoveryHeadLSNUsesRecoveredFrontier(t *testing.T) { func TestWALStore_MultiBlockFlusherSplitsPerBlock(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -322,7 +322,7 @@ func TestWALStore_MultiBlockFlusherSplitsPerBlock(t *testing.T) { func TestWALStore_MultiBlockScanLBAsSplitsPerLSN(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/walstore_persisted_tail_test.go b/seaweed-block/core/storage/walstore_persisted_tail_test.go index ae0d9b6ae3..5b35a16deb 100644 --- a/seaweed-block/core/storage/walstore_persisted_tail_test.go +++ b/seaweed-block/core/storage/walstore_persisted_tail_test.go @@ -41,7 +41,7 @@ func TestWALStoreAppendDuringFlushThenTornWrapKeepsSyncedRecords(t *testing.T) { ) S := uint64(walEntryHeaderSize + blockSize) path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, blockSize, walSize) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, blockSize, walSize) s.DisableAutoFlushForRecoveryTest() if _, err := s.Write(0, makeBlock(blockSize, 0x10)); err != nil { // LSN 1 t.Fatal(err) @@ -87,7 +87,7 @@ func TestWALStoreAppendDuringFlushThenTornWrapKeepsSyncedRecords(t *testing.T) { t.Fatal(err) } crashRecoveryHardeningStore(t, s) - r, err := OpenWALStore(path) + r, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -106,7 +106,7 @@ func TestWALStoreAppendDuringFlushThenTornWrapKeepsSyncedRecords(t *testing.T) { func TestWALStoreFlushPersistsTheReleasedTail(t *testing.T) { const blockSize = 4096 path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, blockSize, 24*1024) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, blockSize, 24*1024) s.DisableAutoFlushForRecoveryTest() t.Cleanup(func() { _ = s.Close() }) for round := 0; round < 3; round++ { @@ -134,7 +134,7 @@ func TestWALStoreFlushPersistsTheReleasedTail(t *testing.T) { func TestWALStoreRecoverPersistsTheRecoveredBounds(t *testing.T) { const blockSize = 4096 path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, blockSize, 24*1024) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, blockSize, 24*1024) s.DisableAutoFlushForRecoveryTest() if _, err := s.Write(0, makeBlock(blockSize, 0x30)); err != nil { // LSN 1 t.Fatal(err) @@ -162,7 +162,7 @@ func TestWALStoreRecoverPersistsTheRecoveredBounds(t *testing.T) { t.Fatal(err) } crashRecoveryHardeningStore(t, s) - r, err := OpenWALStore(path) + r, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -218,7 +218,7 @@ func TestWALStoreFullFlushThenTornWrapKeepsSyncedRecords(t *testing.T) { ) S := uint64(walEntryHeaderSize + blockSize) path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, blockSize, walSize) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, blockSize, walSize) s.DisableAutoFlushForRecoveryTest() if _, err := s.Write(0, makeBlock(blockSize, 0x10)); err != nil { // LSN 1 t.Fatal(err) @@ -252,7 +252,7 @@ func TestWALStoreFullFlushThenTornWrapKeepsSyncedRecords(t *testing.T) { t.Fatal(err) } crashRecoveryHardeningStore(t, s) - r, err := OpenWALStore(path) + r, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -362,7 +362,7 @@ func TestWALStoreRecoverBoundsPersistFailureRefusesAppendsUntilRetry(t *testing. for _, seam := range []string{"write", "sync"} { t.Run(seam, func(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, blockSize, 24*1024) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, blockSize, 24*1024) s.DisableAutoFlushForRecoveryTest() crashed := false t.Cleanup(func() { @@ -397,7 +397,7 @@ func TestWALStoreRecoverBoundsPersistFailureRefusesAppendsUntilRetry(t *testing. crashRecoveryHardeningStore(t, s) crashed = true - r, err := OpenWALStore(path) + r, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -436,7 +436,7 @@ func TestWALStoreRecoverBoundsPersistFailureRefusesAppendsUntilRetry(t *testing. } crashRecoveryHardeningStore(t, r) rClosed = true - r2, err := OpenWALStore(path) + r2, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -466,7 +466,7 @@ func TestWALStoreRecoverBoundsPersistFailureRefusesAppendsUntilRetry(t *testing. crashRecoveryHardeningStore(t, live) rClosed = true - q, err := OpenWALStore(path) + q, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/walstore_readonly.go b/seaweed-block/core/storage/walstore_readonly.go index 87f8d14325..e699638bca 100644 --- a/seaweed-block/core/storage/walstore_readonly.go +++ b/seaweed-block/core/storage/walstore_readonly.go @@ -64,6 +64,10 @@ func OpenReadOnly(path string) (*WALStoreReader, error) { } func OpenReadOnlyWithOptions(path string, opts WALStoreOptions) (*WALStoreReader, error) { + return openReadOnlyV3(path, opts) +} + +func openLegacyReadOnlyWithOptions(path string, opts WALStoreOptions) (*WALStoreReader, error) { f, err := os.OpenFile(path, os.O_RDONLY, 0) if err != nil { return nil, fmt.Errorf("storage: OpenReadOnly %s: %w", path, err) diff --git a/seaweed-block/core/storage/walstore_readonly_v3.go b/seaweed-block/core/storage/walstore_readonly_v3.go index 6698e44a58..ef5f4fe268 100644 --- a/seaweed-block/core/storage/walstore_readonly_v3.go +++ b/seaweed-block/core/storage/walstore_readonly_v3.go @@ -29,10 +29,9 @@ type walStoreReaderV3 struct { absent map[uint64]bool } -// Dark row12a selector. Public OpenReadOnly still selects the legacy reader; -// activation changes that selector only after all named callers are accepted. +// The production readonly selector validates v3 slots and their dependencies. // No worker, recovery fence, descriptor publication or writable fd is created. -func openReadOnlyV3ForTest(path string, opts WALStoreOptions) (_ *WALStoreReader, err error) { +func openReadOnlyV3(path string, opts WALStoreOptions) (_ *WALStoreReader, err error) { f, err := os.Open(path) if err != nil { return nil, err @@ -46,6 +45,10 @@ func openReadOnlyV3ForTest(path string, opts WALStoreOptions) (_ *WALStoreReader if err := LockWALStoreFile(f); err != nil { return nil, err } + if err := refuseLegacyWALStore(f); err != nil { + return nil, err + } + accept := metadataSlotAcceptorV3(opts) a, b := make([]byte, slotSizeV3), make([]byte, slotSizeV3) if _, err = f.ReadAt(a, slotAOffsetV3); err != nil { return nil, err @@ -53,7 +56,7 @@ func openReadOnlyV3ForTest(path string, opts WALStoreOptions) (_ *WALStoreReader if _, err = f.ReadAt(b, slotBOffsetV3); err != nil { return nil, err } - d, id, err := selectSlotV3(a, b, nil) + d, id, err := selectSlotV3(a, b, accept) if err != nil { return nil, err } @@ -62,7 +65,7 @@ func openReadOnlyV3ForTest(path string, opts WALStoreOptions) (_ *WALStoreReader otherRaw = a } var fallback *descriptorV3 - if od, e := decodeSlotV3(otherRaw, nil); e == nil && od.MigrationPhase == MigrationNormal { + if od, e := decodeSlotV3(otherRaw, accept); e == nil && od.MigrationPhase == MigrationNormal { fallback = &od } cb, err := validateReadOnlyMapV3(path+".chunkmap", d, fallback) @@ -75,7 +78,7 @@ func openReadOnlyV3ForTest(path string, opts WALStoreOptions) (_ *WALStoreReader if err != nil { return nil, err } - scan, err := scanWALV3(f, d) + scan, err := scanWALV3Accepted(f, d, accept) if err != nil { return nil, err } diff --git a/seaweed-block/core/storage/walstore_readonly_v3_test.go b/seaweed-block/core/storage/walstore_readonly_v3_test.go index 998edc01e2..d56b391ff8 100644 --- a/seaweed-block/core/storage/walstore_readonly_v3_test.go +++ b/seaweed-block/core/storage/walstore_readonly_v3_test.go @@ -37,7 +37,7 @@ func TestWALStoreV3_ReadOnlyMergesWALAndExtentWithoutWrites(t *testing.T) { if err != nil { t.Fatal(err) } - reader, err := openReadOnlyV3ForTest(path, WALStoreOptions{}) + reader, err := OpenReadOnlyWithOptions(path, WALStoreOptions{}) if err != nil { t.Fatalf("actual readonly v3 open refused: %v", err) } @@ -144,7 +144,7 @@ func TestWALStoreV3_ReadOnlyRefusesIncompleteOrCorruptDependencies(t *testing.T) if e != nil { t.Fatal(e) } - reader, e := openReadOnlyV3ForTest(path, WALStoreOptions{}) + reader, e := OpenReadOnlyWithOptions(path, WALStoreOptions{}) if reader != nil { _ = reader.Close() t.Error("refused readonly returned a reader") @@ -175,7 +175,7 @@ func TestWALStoreV3_ReadOnlyNeverReturnsUnfilledExtentZeros(t *testing.T) { if e := os.WriteFile(path+".chunkpresence", []byte("absent 1\nlocal 4\n"), 0600); e != nil { t.Fatal(e) } - r, e := openReadOnlyV3ForTest(path, WALStoreOptions{}) + r, e := OpenReadOnlyWithOptions(path, WALStoreOptions{}) if e != nil { t.Fatal(e) } @@ -209,7 +209,7 @@ func TestWALStoreV3_ReadOnlyRevalidatesWALAndBindsReadonlyMetadata(t *testing.T) h.file = f return BlockMetadataBinding{ImplVersion: 3, Hook: h}, nil }} - r, e := openReadOnlyV3ForTest(path, opts) + r, e := OpenReadOnlyWithOptions(path, opts) if e != nil { t.Fatal(e) } diff --git a/seaweed-block/core/storage/walstore_recovery.go b/seaweed-block/core/storage/walstore_recovery.go index b833ccfaec..4863ddf316 100644 --- a/seaweed-block/core/storage/walstore_recovery.go +++ b/seaweed-block/core/storage/walstore_recovery.go @@ -305,7 +305,7 @@ func (s *WALStore) scanLBAsV3(fromLSN uint64, fn func(RecoveryEntry) error) erro if h := v.testScanBeforeRead; h != nil { h() } - scan, err := scanWALV3(s.fd, d) + scan, err := scanWALV3Accepted(s.fd, d, v.pub.accept) if err != nil { return fmt.Errorf("storage: walstore ScanLBAs (v3): %w", err) } diff --git a/seaweed-block/core/storage/walstore_recovery_frontier_gap_test.go b/seaweed-block/core/storage/walstore_recovery_frontier_gap_test.go index 7740289100..af72edc020 100644 --- a/seaweed-block/core/storage/walstore_recovery_frontier_gap_test.go +++ b/seaweed-block/core/storage/walstore_recovery_frontier_gap_test.go @@ -17,7 +17,7 @@ import ( func TestWALStoreRecoverKeepsSyncedEntriesAboveAnUnpersistedFrontierJump(t *testing.T) { const blockSize = 4096 path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, blockSize, 24*1024) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, blockSize, 24*1024) s.DisableAutoFlushForRecoveryTest() crashed := false t.Cleanup(func() { @@ -47,7 +47,7 @@ func TestWALStoreRecoverKeepsSyncedEntriesAboveAnUnpersistedFrontierJump(t *test if sb := diskSuperblockForGapTest(t, path); sb.WALCheckpointLSN != 0 { t.Fatalf("persisted checkpoint %d; want 0 (the frontier jump is not persisted)", sb.WALCheckpointLSN) } - r, err := OpenWALStore(path) + r, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/walstore_recovery_hardening_test.go b/seaweed-block/core/storage/walstore_recovery_hardening_test.go index ba5f7afb79..0d70159a0d 100644 --- a/seaweed-block/core/storage/walstore_recovery_hardening_test.go +++ b/seaweed-block/core/storage/walstore_recovery_hardening_test.go @@ -12,7 +12,7 @@ import ( func TestWALStoreRecoverRetainsMultiBlockSuffixAcrossRestart(t *testing.T) { const blockSize = 4096 path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 32, blockSize) + s, err := createLegacyWALStoreForTest(path, 32, blockSize) if err != nil { t.Fatal(err) } @@ -55,7 +55,7 @@ func TestWALStoreRecoverRetainsMultiBlockSuffixAcrossRestart(t *testing.T) { } crashRecoveryHardeningStore(t, s) - reopened, err := OpenWALStore(path) + reopened, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -126,7 +126,7 @@ func TestWALStoreRecoverRejectsOverflowingBatchGeometry(t *testing.T) { blocks = 3 ) path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 16, blockSize) + s, err := createLegacyWALStoreForTest(path, 16, blockSize) if err != nil { t.Fatal(err) } @@ -149,7 +149,7 @@ func TestWALStoreRecoverRejectsOverflowingBatchGeometry(t *testing.T) { ) crashRecoveryHardeningStore(t, s) - reopened, err := OpenWALStore(path) + reopened, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -176,7 +176,7 @@ func TestWALStoreRecoverReconstructsLegacyWrappedRetainedWindow(t *testing.T) { lowRecordSize = uint64(walEntryHeaderSize + 2*blockSize) ) path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, blockSize, walSize) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, blockSize, walSize) s.DisableAutoFlushForRecoveryTest() for lba := uint32(0); lba < 3; lba++ { if _, err := s.Write(lba, makeBlock(blockSize, byte(0x10+lba))); err != nil { @@ -228,7 +228,7 @@ func TestWALStoreRecoverReconstructsLegacyWrappedRetainedWindow(t *testing.T) { } crashRecoveryHardeningStore(t, s) - reopened, err := OpenWALStore(path) + reopened, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/walstore_recovery_lww_test.go b/seaweed-block/core/storage/walstore_recovery_lww_test.go index f51c985cc3..fa41e928e2 100644 --- a/seaweed-block/core/storage/walstore_recovery_lww_test.go +++ b/seaweed-block/core/storage/walstore_recovery_lww_test.go @@ -16,7 +16,7 @@ func TestWALStoreRecoverLastWriterWinsAcrossScanOrder(t *testing.T) { walSize = 24 * 1024 ) path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, blockSize, walSize) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, blockSize, walSize) s.DisableAutoFlushForRecoveryTest() for lba := uint32(0); lba < 3; lba++ { if _, err := s.Write(lba, makeBlock(blockSize, byte(0x10+lba))); err != nil { @@ -45,7 +45,7 @@ func TestWALStoreRecoverLastWriterWinsAcrossScanOrder(t *testing.T) { t.Fatalf("newest LBA 20 entry at offset %d LSN %d; want the wrapped batch at 0, LSN 5", e.WALOffset, e.LSN) } crashRecoveryHardeningStore(t, s) - r, err := OpenWALStore(path) + r, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/walstore_retention_test.go b/seaweed-block/core/storage/walstore_retention_test.go index 3e496b0e34..51960def7b 100644 --- a/seaweed-block/core/storage/walstore_retention_test.go +++ b/seaweed-block/core/storage/walstore_retention_test.go @@ -28,7 +28,7 @@ func freshWALStore(t *testing.T) *WALStore { t.Helper() dir := t.TempDir() path := filepath.Join(dir, "v.bin") - ws, err := CreateWALStore(path, 64, 4096) + ws, err := createLegacyWALStoreForTest(path, 64, 4096) if err != nil { t.Fatalf("CreateWALStore: %v", err) } diff --git a/seaweed-block/core/storage/walstore_sticky_fsync_test.go b/seaweed-block/core/storage/walstore_sticky_fsync_test.go index 4ce832851b..00b0234a1c 100644 --- a/seaweed-block/core/storage/walstore_sticky_fsync_test.go +++ b/seaweed-block/core/storage/walstore_sticky_fsync_test.go @@ -28,7 +28,7 @@ func assertStickyFsync(t *testing.T, err error) { func stickyStore(t *testing.T) (*WALStore, string) { t.Helper() path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, 4096, 64*1024) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, 4096, 64*1024) s.DisableAutoFlushForRecoveryTest() if _, err := s.Write(0, makeBlock(4096, 0x10)); err != nil { // acked before the fault t.Fatal(err) @@ -63,7 +63,7 @@ func assertRefusesAfterFault(t *testing.T, s *WALStore, path string) { t.Fatalf("the flusher advanced the checkpoint %d -> %d after an fsync failure", ckpt, got) } _ = s.Close() - r, err := OpenWALStore(path) + r, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/walstore_sticky_race_test.go b/seaweed-block/core/storage/walstore_sticky_race_test.go index 62a302055d..11c89f09d1 100644 --- a/seaweed-block/core/storage/walstore_sticky_race_test.go +++ b/seaweed-block/core/storage/walstore_sticky_race_test.go @@ -117,7 +117,7 @@ func startWorker(t workerTB, fn func() error, gates ...*gate) <-chan error { func heldStore(t *testing.T) (*WALStore, string) { t.Helper() path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, 4096, 64*1024) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, 4096, 64*1024) s.DisableAutoFlushForRecoveryTest() t.Cleanup(func() { // runs after the workers' and gates' cleanups (LIFO) if _, leaked := leakedStores.LoadAndDelete(t); leaked { diff --git a/seaweed-block/core/storage/walstore_sync_frontier_order_test.go b/seaweed-block/core/storage/walstore_sync_frontier_order_test.go index 2145b46ce9..99803d6e9e 100644 --- a/seaweed-block/core/storage/walstore_sync_frontier_order_test.go +++ b/seaweed-block/core/storage/walstore_sync_frontier_order_test.go @@ -13,7 +13,7 @@ import ( func TestWALGenerationFirstCallerReturnOrdering(t *testing.T) { for _, laterPublishesFirst := range []bool{false, true} { t.Run(fmt.Sprintf("later_publishes_first=%v", laterPublishesFirst), func(t *testing.T) { - s := newGenerationStore(t) + s := newLegacyGenerationStore(t) firstEntered, secondEntered, firstCacheReturned := make(chan struct{}), make(chan struct{}), make(chan struct{}) releaseFirst, releaseSecond, publishFirst := make(chan struct{}), make(chan struct{}), make(chan struct{}) var workers sync.WaitGroup diff --git a/seaweed-block/core/storage/walstore_sync_generation_test.go b/seaweed-block/core/storage/walstore_sync_generation_test.go index 25756f7de3..083a7ae694 100644 --- a/seaweed-block/core/storage/walstore_sync_generation_test.go +++ b/seaweed-block/core/storage/walstore_sync_generation_test.go @@ -12,7 +12,9 @@ import ( func newGenerationStore(t *testing.T) *WALStore { t.Helper() - s, err := CreateWALStore(filepath.Join(t.TempDir(), "store.bin"), 32, 4096) + // This control holds the standalone WAL fsync seam. Mode A retains + // that phase; mode C combines WAL durability with descriptor publication. + s, err := CreateWALStoreWithOptions(filepath.Join(t.TempDir(), "store.bin"), 32, 4096, WALStoreOptions{WMode: WModeStrict}) if err != nil { t.Fatal(err) } @@ -179,7 +181,7 @@ func TestWALGenerationSyncFailureAndShutdown(t *testing.T) { func TestWALGenerationBypassesUntrackedMutationPaths(t *testing.T) { for _, kind := range []string{"old LSN apply", "direct extent", "direct frontier", "chunk layer"} { t.Run(kind, func(t *testing.T) { - s := newGenerationStore(t) + s := newLegacyGenerationStore(t) if _, err := s.Write(0, makeBlock(4096, 0x81)); err != nil { t.Fatal(err) } @@ -246,7 +248,7 @@ func TestWALGenerationPartialAppendRecoverySync(t *testing.T) { for _, recoverFirst := range []bool{false, true} { t.Run(map[bool]string{false: "failed append without recovery", true: "same-open recovery"}[recoverFirst], func(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") - s := createWALStoreWithWALSizeForTest(t, path, 64, 4096, 1<<20) + s := createLegacyWALStoreWithWALSizeForTest(t, path, 64, 4096, 1<<20) s.DisableAutoFlushForRecoveryTest() if _, err := s.Sync(); err != nil { t.Fatal(err) @@ -292,7 +294,7 @@ func TestWALGenerationPartialAppendRecoverySync(t *testing.T) { // A reopen may republish the failed batch's complete prefix (it // was never acknowledged) and serves normally again. - r, err := OpenWALStore(path) + r, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -358,3 +360,17 @@ func TestWALGenerationSameOpenRecoverInvalidatesCoverage(t *testing.T) { t.Fatalf("Recover permanently disabled dedup: syncs=%d want1", n) } } + +// TODO(format-v3 row 14a): v2 callback-cache / direct-mutation controls only. +func newLegacyGenerationStore(t *testing.T) *WALStore { + t.Helper() + // This control holds the standalone WAL fsync seam. Mode A retains + // that phase; mode C combines WAL durability with descriptor publication. + s, err := createLegacyWALStoreWithOptions(filepath.Join(t.TempDir(), "store.bin"), 32, 4096, WALStoreOptions{WMode: WModeStrict}) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = s.Close() }) + s.DisableAutoFlushForRecoveryTest() + return s +} diff --git a/seaweed-block/core/storage/walstore_test.go b/seaweed-block/core/storage/walstore_test.go index cf72f5a04b..9c979f1c20 100644 --- a/seaweed-block/core/storage/walstore_test.go +++ b/seaweed-block/core/storage/walstore_test.go @@ -10,7 +10,7 @@ import ( func TestWALStore_FailedAppendDoesNotConsumeLSN(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -47,7 +47,7 @@ func TestWALStore_FailedAppendDoesNotConsumeLSN(t *testing.T) { // A reopen starts from what is on disk (nothing of the failed append): // the first write gets LSN 1, the next batch LSNs 2 and 3. - r, err := OpenWALStore(path) + r, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -112,7 +112,7 @@ func TestWALStore_SyncDoesNotClaimConcurrentWrite(t *testing.T) { func TestWALStore_DirectFrontierMetadataFailureRetainsRetryState(t *testing.T) { path := filepath.Join(t.TempDir(), "store.bin") - s, err := CreateWALStore(path, 16, 4096) + s, err := createLegacyWALStoreForTest(path, 16, 4096) if err != nil { t.Fatal(err) } @@ -151,7 +151,7 @@ func TestWALStore_DirectFrontierMetadataFailureRetainsRetryState(t *testing.T) { t.Fatalf("refused retry published checkpoint %d", s.checkpointLSN) } _ = s.Close() - reopened, err := OpenWALStore(path) + reopened, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } @@ -181,7 +181,7 @@ func TestWALStore_DirectFrontierMetadataFailureRetainsRetryState(t *testing.T) { reopened.committer.Stop() _ = reopened.fd.Close() // crash reopenedOpen = false - again, err := OpenWALStore(path) + again, err := openLegacyWALStoreForTest(path) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/walstore_v3.go b/seaweed-block/core/storage/walstore_v3.go index 11dfd550d9..d61d837c7f 100644 --- a/seaweed-block/core/storage/walstore_v3.go +++ b/seaweed-block/core/storage/walstore_v3.go @@ -5,6 +5,7 @@ import ( "encoding/binary" "errors" "fmt" + "io" "os" "sync" "sync/atomic" @@ -19,12 +20,9 @@ import ( // committer, the dirty map, the flusher's extent writes, the syncFile leaf, // fileSyncMu and the sticky fault. // -// Dark until activation (plan row 12b): only createWALStoreV3ForTest and -// openWALStoreV3ForTest build a v3 store; Create and Open stay v2. -// -// Not yet v3 (refused with errV3NotYet until their rows): WriteBatch, the -// install paths (ApplyEntry, WriteExtentDirect, AdvanceFrontier; rows 9 to -// 11) and the checkpoint/tail advance, which needs the row-7 map candidate. +// Production Create/Open select this format. Legacy formats require the offline +// migration tool or restore into a newly created volume. BASE mutations use +// install handles; raw extent writes and frontier jumps remain refused. type walStoreV3State struct { pub *descriptorPublisherV3 w *walWriterV3 @@ -140,13 +138,50 @@ var errV3LegacySuperblockWrite = errors.New("storage: legacy superblock write re var errV3NotYet = errors.New("storage: operation not yet supported on a v3 store (later plan row)") +// ErrUnsupportedLegacyFormat requires offline migration or workspace restore; +// a production open never interprets a v2 volume as v3. +var ErrUnsupportedLegacyFormat = errors.New("storage: unsupported legacy walstore format; migrate offline or restore into a new volume") + +func refuseLegacyWALStore(f *os.File) error { + if sb, err := readSuperblock(io.NewSectionReader(f, 0, superblockSize)); err == nil && sb.Version == 2 && sb.validate() == nil { + return ErrUnsupportedLegacyFormat + } + return nil +} + +func metadataSlotAcceptorV3(opts WALStoreOptions) slotImplAcceptor { + return func(kind ImplKind, version uint32) bool { + return ossSlotImplAcceptor(kind, version) || + (kind == ImplKindWALStore && version >= walStoreImplVersion3 && opts.MetadataFactory != nil) + } +} + +// ProbeWALStoreV3 identifies a valid OSS descriptor through the same A/B +// selector as open. It grants no ownership or serving permission; Open +// acquires the file lock and validates all map dependencies afresh. +func ProbeWALStoreV3(path string) error { + f, err := os.Open(path) + if err != nil { + return err + } + defer f.Close() + a, b := make([]byte, slotSizeV3), make([]byte, slotSizeV3) + if _, err := f.ReadAt(a, 0); err != nil { + return err + } + if _, err := f.ReadAt(b, slotBOffsetV3); err != nil { + return err + } + _, _, err = selectSlotV3(a, b, nil) + return err +} + // testSkipFenceOnRecoverV3 is a test-only mutant switch for the G1 control // (it proves the schedule resurrects without the fence). Never set outside // tests. var testSkipFenceOnRecoverV3 bool -// FormatV3 reports whether the store runs the dark v3 format (only test -// constructors build one before activation, plan row 12b). +// FormatV3 reports whether the store uses the v3 format. func (s *WALStore) FormatV3() bool { return s.v3 != nil } func (s *WALStore) latchV3(err error) { @@ -183,10 +218,14 @@ func createMappedWALStoreV3ForTest(path string, numBlocks, blockSize uint32, wal var testCreateOwnerV3 func(*os.File, bool) func createWALStoreV3MapAtCursorForTest(path string, numBlocks, blockSize uint32, walSize uint64, mode WMode, cursor, chunkBlocks uint64) (*WALStore, error) { + return createWALStoreV3Configured(path, numBlocks, blockSize, walSize, mode, cursor, chunkBlocks, WALStoreOptions{}) +} + +func createWALStoreV3Configured(path string, numBlocks, blockSize uint32, walSize uint64, mode WMode, cursor, chunkBlocks uint64, opts WALStoreOptions) (*WALStore, error) { d := descriptorV3{ ImplKind: ImplKindWALStore, ImplVersion: walStoreImplVersion3, VolumeSize: uint64(numBlocks) * uint64(blockSize), ExtentSize: 64 * 1024, BlockSize: blockSize, - WALOffset: walOffsetV3, WALSize: walSize, CreatedAt: 1, SlotGen: 1, + WALOffset: walOffsetV3, WALSize: walSize, CreatedAt: uint64(time.Now().UnixNano()), SlotGen: 1, MapFormatID: mapFormatIDV1, MapGeneration: 1, WMode: mode, RetainedTail: cursor, RetainedHead: cursor, } @@ -209,7 +248,18 @@ func createWALStoreV3MapAtCursorForTest(path string, numBlocks, blockSize uint32 if h := testCreateOwnerV3; h != nil { h(fd, false) } - err = fd.Truncate(int64(d.WALOffset + d.WALSize + d.VolumeSize)) + sb := superblock{Version: superblockVersionV3, ImplVersion: d.ImplVersion, BlockSize: d.BlockSize, VolumeSize: d.VolumeSize, WALOffset: d.WALOffset, WALSize: d.WALSize} + metadata, totalSize, err := bindBlockMetadata(fd, &sb, opts, true, false) + if err != nil { + _ = fd.Close() + return nil, err + } + d.ImplVersion = sb.ImplVersion + if err := d.validate(metadataSlotAcceptorV3(opts)); err != nil { + _ = fd.Close() + return nil, err + } + err = fd.Truncate(totalSize) if err == nil && chunkBlocks != 0 { var m *chunkLSNMapV3 m, err = createChunkLSNMapV3(path+".chunkmap", d, chunkBlocks) @@ -239,16 +289,14 @@ func createWALStoreV3MapAtCursorForTest(path string, numBlocks, blockSize uint32 if err == nil { err = fd.Sync() } - if err == nil { - if h := testCreateOwnerV3; h != nil { - h(fd, true) - } - } if err != nil { _ = fd.Close() return nil, err } - s, err := openWALStoreV3File(path, fd, chunkBlocks != 0) + if h := testCreateOwnerV3; h != nil { + h(fd, true) + } + s, err := openWALStoreV3File(path, fd, chunkBlocks != 0, opts, metadata, true) if err != nil { return nil, err } @@ -271,6 +319,10 @@ func openUnmappedWALStoreV3ForTest(path string) (*WALStore, error) { return openWALStoreV3MapInternalForTest(path, false) } func openWALStoreV3MapInternalForTest(path string, requireMap bool) (*WALStore, error) { + return openWALStoreV3WithOptions(path, requireMap, WALStoreOptions{}) +} + +func openWALStoreV3WithOptions(path string, requireMap bool, opts WALStoreOptions) (*WALStore, error) { f, err := os.OpenFile(path, os.O_RDWR, 0o644) if err != nil { return nil, fmt.Errorf("storage: open %s: %w", path, err) @@ -279,12 +331,17 @@ func openWALStoreV3MapInternalForTest(path string, requireMap bool) (*WALStore, _ = f.Close() return nil, err } - return openWALStoreV3File(path, f, requireMap) + return openWALStoreV3File(path, f, requireMap, opts, nil, false) } -// openWALStoreV3File consumes an already locked descriptor, including on error. -// Creation transfers ownership directly: no selectable-slot close/reopen gap. -func openWALStoreV3File(path string, f *os.File, requireMap bool) (*WALStore, error) { +// f is already locked. Creation retains this same descriptor and metadata +// binding throughout initialization, so there is no close/reopen owner gap. +func openWALStoreV3File(path string, f *os.File, requireMap bool, opts WALStoreOptions, metadata BlockMetadata, creating bool) (*WALStore, error) { + if err := refuseLegacyWALStore(f); err != nil { + _ = f.Close() + return nil, err + } + accept := metadataSlotAcceptorV3(opts) a := make([]byte, slotSizeV3) b := make([]byte, slotSizeV3) _, errA := f.ReadAt(a, slotAOffsetV3) @@ -293,7 +350,7 @@ func openWALStoreV3File(path string, f *os.File, requireMap bool) (*WALStore, er _ = f.Close() return nil, err } - d, id, err := selectSlotV3(a, b, nil) + d, id, err := selectSlotV3(a, b, accept) if err != nil { _ = f.Close() return nil, err @@ -303,7 +360,7 @@ func openWALStoreV3File(path string, f *os.File, requireMap bool) (*WALStore, er if id == slotB { otherRaw = a } - if od, oerr := decodeSlotV3(otherRaw, nil); oerr == nil && od.MigrationPhase == MigrationNormal { + if od, oerr := decodeSlotV3(otherRaw, accept); oerr == nil && od.MigrationPhase == MigrationNormal { other = &od } var ownedMap *chunkLSNMapV3 @@ -326,7 +383,17 @@ func openWALStoreV3File(path string, f *os.File, requireMap bool) (*WALStore, er CreatedAt: d.CreatedAt, ImplKind: d.ImplKind, ImplVersion: d.ImplVersion, } copy(sb.Magic[:], superblockMagic) - s, err := openInitializedInternal(path, f, &sb, nil, func(s *WALStore) error { + if !creating && opts.MetadataFactory != nil { + metadata, _, err = bindBlockMetadata(f, &sb, opts, false, false) + if err != nil { + if ownedMap != nil { + _ = ownedMap.Close() + } + _ = f.Close() + return nil, err + } + } + s, err := openInitializedInternal(path, f, &sb, metadata, func(s *WALStore) error { v := &walStoreV3State{} v.pub = newDescriptorPublisherV3(d, id, other, descriptorIOV3{ writeSlot: func(off int64, buf []byte) error { @@ -346,6 +413,7 @@ func openWALStoreV3File(path string, f *os.File, requireMap bool) (*WALStore, er sticky: s.stickyIOFault, latch: s.latchV3, }) + v.pub.accept = accept // A reset stopped between its two publications (DESIGN 8.6) binds no // writer across the two nonces: Recover's head publication completes // the new incarnation in the other slot and creates the writer then; @@ -356,6 +424,7 @@ func openWALStoreV3File(path string, f *os.File, requireMap bool) (*WALStore, er return err } v.w = w + v.w.instr = &s.instr } v.wack.Store(d.W) if ownedMap != nil { @@ -391,7 +460,7 @@ func (s *WALStore) recoverV3() (uint64, error) { } d := v.pub.current() s.dm.clear() - scan, err := scanWALV3(s.fd, d) + scan, err := scanWALV3Accepted(s.fd, d, v.pub.accept) if err != nil { if d.BaseState == BaseInstalling { // Installing keeps its typed not-ready outcome; the cause is a @@ -523,6 +592,7 @@ func (s *WALStore) recoverV3() (uint64, error) { return 0, err } v.w = w + v.w.instr = &s.instr } restore := scan restore.End = o.E @@ -609,13 +679,17 @@ func (s *WALStore) appendWriteV3(lba uint32, data []byte, lsn uint64) (uint64, e // r16). A single block is an ordinary write record. Each block's dirty // entry names its data offset inside the record. func (s *WALStore) writeBatchV3Locked(startLBA uint32, blocks [][]byte, firstLSN uint64) ([]uint64, error) { + start := time.Now() if len(blocks) == 1 { phys, err := s.appendWriteV3(startLBA, blocks[0], firstLSN) + s.instr.appendLatency.Observe(time.Since(start)) s.walMutation.Add(1) if err != nil { return nil, fmt.Errorf("storage: WAL append: %w", err) } + dirtyStart := time.Now() s.dm.put(uint64(startLBA), phys, firstLSN, uint32(len(blocks[0]))) + s.instr.recordDirtyMapUpdate(1, time.Since(dirtyStart)) s.noteChunkMutation(uint64(startLBA)) s.advanceAfterAppendV3(firstLSN, firstLSN) return []uint64{firstLSN}, nil @@ -625,9 +699,11 @@ func (s *WALStore) writeBatchV3Locked(startLBA uint32, blocks [][]byte, firstLSN } bs := int(s.sb.BlockSize) payload := make([]byte, 0, len(blocks)*bs) + copyStart := time.Now() for _, b := range blocks { payload = append(payload, b...) } + s.instr.recordWALCopy(len(payload), time.Since(copyStart)) n := uint64(len(blocks)) lastLSN := firstLSN + n - 1 if s.v3.mapProof != nil { @@ -640,6 +716,7 @@ func (s *WALStore) writeBatchV3Locked(startLBA uint32, blocks [][]byte, firstLSN return nil, err } phys, err := s.v3.w.append(e, s.v3.wack.Load()) + s.instr.appendLatency.Observe(time.Since(start)) s.walMutation.Add(1) if err != nil { if errors.Is(err, errWALPwrite) { @@ -648,6 +725,7 @@ func (s *WALStore) writeBatchV3Locked(startLBA uint32, blocks [][]byte, firstLSN return nil, fmt.Errorf("storage: WAL batch append: %w", err) } lsns := make([]uint64, n) + dirtyStart := time.Now() for i := uint64(0); i < n; i++ { lba := uint64(startLBA) + i lsns[i] = firstLSN + i @@ -655,6 +733,7 @@ func (s *WALStore) writeBatchV3Locked(startLBA uint32, blocks [][]byte, firstLSN s.dm.putAt(lba, phys, uint32(i)*uint32(bs), lsns[i], uint32(bs)) s.noteChunkMutation(lba) } + s.instr.recordDirtyMapUpdate(len(blocks), time.Since(dirtyStart)) s.v3.appended.Store(lastLSN) s.advanceAfterAppendV3(firstLSN, lastLSN) return lsns, nil @@ -712,6 +791,10 @@ func (s *WALStore) syncWALBatchV3() error { v.syncMu.Lock() defer v.syncMu.Unlock() H, prev := v.appended.Load(), v.wack.Load() + // One sample per covering WAL batch, as on v2. In mode C the slot + // publication is the physical sync; mode A also settles its W slot. + syncStart := time.Now() + defer func() { s.fileSyncLatency.Observe(time.Since(syncStart)) }() switch v.pub.current().WMode { case WModeStrict: // A: fsync the WAL, then publish W = H with its own fsync. diff --git a/seaweed-block/docs/design/block-design.md b/seaweed-block/docs/design/block-design.md index 8552681c71..dae9c48a72 100644 --- a/seaweed-block/docs/design/block-design.md +++ b/seaweed-block/docs/design/block-design.md @@ -95,6 +95,22 @@ stateDiagram-v2 ## 1.2 walstore: WAL plus extent +**Production format v3.** Create writes impl3; v2/impl1 and v2/impl2 require explicit offline migration or recreation/HEAD restore. Chunk geometry is fixed at create from the provider configuration. Mode C is the default; mode A is an explicit create option. Both descriptor slots and their owned immutable map dependencies are validated at open, under exclusive file ownership. The creator holds that same fd from O_EXCL through slot publication and store construction. + +```mermaid +flowchart LR + A["slot A: 0..4095"] --- B["slot B: 4096..8191"] --- W["WAL: starts 8192"] --- E["block extent"] + A -. "root hash / lineage" .-> M["owned COW chunk LSN map sidecar"] + B -. "both valid slots pin dependencies" .-> M + F["extent fsync + metadata barrier"] --> C["COW map durable"] --> P["single descriptor publisher"] --> R["reuse only above both-slot floor"] +``` + +The native record is a 62-byte prefix (LSN, batch count, type/flags, LBA/length, DurableLSN, absolute logical start and 128-bit WAL nonce) plus payload and an 8-byte CRC32C/size trailer: 70 bytes overhead. Appends are physically LSN-strict within an incarnation. Reads validate the entire containing record before returning a block. Recovery uses the physical trusted prefix and the mode/BASE watermark rules, then fences dropped byte ranges before reuse. Same-open Recover invalidates map proofs at both entry and exit. All runtime descriptor mutations converge through `descriptorPublisherV3.publishLockedCoreV3`; initial creation and the explicitly offline migration tool are the pre-serving exceptions. + +The flusher prepares map coverage within its original recovery lifetime, syncs extent and metadata, and publishes checkpoint/map/W/tail together; fallback rollover releases no bytes until both slots permit it. Installed/installing BASE uses install handles; logical Sync while installing is refused, while receiver-only SyncInstallLog follows strict durability. Mode C physically syncs each covering batch but can persist the previous acknowledged W; A persists the current covering W before acknowledgment. The final mode-C window and corruption oracles are specified by the canonical format contract; this summary does not weaken its gates. + +The [exact temporary legacy test inventory](format-v3-legacy-test-inventory.md) pairs old-format controls with native replacements. The following original diagrams and scan explanation describe the **legacy v2 fixture/offline-input format**, retained until row 14a; they are not the active production byte layout or recovery algorithm. + **Layout.** One preallocated file with a 4 KB superblock, a circular WAL, and a block-indexed extent (`core/storage/walstore.go`, type comment of `WALStore`). - The superblock holds geometry, `WALHead` and `WALTail` (monotonic logical byte cursors), `WALCheckpointLSN` (the highest LSN durably in the extent) and the engine kind; opening a file of the wrong kind is refused (`core/storage/superblock.go`). - A WAL record is a 30-byte header (LSN, reserved, type, flags, LBA, length), the data, and an 8-byte trailer (CRC32, record size) (`core/storage/wal_entry.go`). A record that does not fit at the end of the region is preceded by a padding record and starts at offset 0 (`core/storage/wal_writer.go` `walWriter.append`). diff --git a/seaweed-block/docs/design/format-v3-legacy-test-inventory.json b/seaweed-block/docs/design/format-v3-legacy-test-inventory.json new file mode 100644 index 0000000000..e5ee469932 --- /dev/null +++ b/seaweed-block/docs/design/format-v3-legacy-test-inventory.json @@ -0,0 +1,1838 @@ +[ + { + "file": "cmd/sw-block/migrate_test.go", + "test": "TestMigrateV3BadGeometryRefusedBeforeAnyWrite", + "legacy_roots": [ + "CreateLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "cmd/sw-block/migrate_test.go", + "test": "TestMigrateV3CleanVolume", + "legacy_roots": [ + "CreateLegacyWALStoreTest", + "OpenLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "cmd/sw-block/migrate_test.go", + "test": "TestMigrateV3CrashAfterEachStepIsResumable", + "legacy_roots": [ + "CreateLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "cmd/sw-block/migrate_format_v3_test.go", + "test": "TestMigrateV3ExcludesOpenUntilCommitFinishes", + "legacy_roots": [ + "CreateLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "cmd/sw-block/migrate_test.go", + "test": "TestMigrateV3NeverRestoresTheBackup", + "legacy_roots": [ + "CreateLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "cmd/sw-block/migrate_test.go", + "test": "TestMigrateV3OldBinaryAfterPreparation", + "legacy_roots": [ + "CreateLegacyWALStoreTest", + "OpenLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "cmd/sw-block/migrate_test.go", + "test": "TestMigrateV3OldWALOverwritesThePreparedSlot", + "legacy_roots": [ + "CreateLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "cmd/sw-block/migrate_format_v3_test.go", + "test": "TestMigrateV3PreparedOnlyRefusedByV3Open", + "legacy_roots": [ + "CreateLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "cmd/sw-block/migrate_test.go", + "test": "TestMigrateV3RefusalsChangeNothing", + "legacy_roots": [ + "CreateLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "cmd/sw-block/migrate_test.go", + "test": "TestMigrateV3RetirementRerunFsyncsTheDirectory", + "legacy_roots": [ + "CreateLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "cmd/sw-block/migrate_format_v3_test.go", + "test": "TestMigrateV3VolumeOpensAsV3", + "legacy_roots": [ + "CreateLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "cmd/sw-block/internal/v2legacy/real_store_legacy_test.go", + "test": "TestReadSuperblockRefusesOtherFormats", + "legacy_roots": [ + "CreateLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "cmd/sw-block/internal/v2legacy/real_store_legacy_test.go", + "test": "TestScanCleanOnRealV2Stores", + "legacy_roots": [ + "CreateLegacyWALStoreTest" + ], + "reason": "real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage", + "v3_controls": [ + "TestMigrateV3VolumeOpensAsV3", + "TestMigrateV3PreparedOnlyRefusedByV3Open" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/flusher_test.go", + "test": "TestAllBlocks_ReturnsBlocksAfterFlush", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestCheckpointPublicationCrashWindowsRemainRecoverable", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_typed_cause_test.go", + "test": "TestChunkCut_BaseInstallRefusalIsTyped", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_typed_cause_test.go", + "test": "TestChunkCut_CASLostToMovedHeadIsHeadConflict", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_typed_cause_test.go", + "test": "TestChunkCut_ClosedLayerIsTyped", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_precopy_test.go", + "test": "TestChunkCut_RecoverWaitsForTheCaptureBarrier", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_lsn_order_test.go", + "test": "TestChunkCut_RemoteLSNNeverDecreases", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_typed_cause_test.go", + "test": "TestChunkCut_UploadFailureIsRemoteUnavailable", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_c11_test.go", + "test": "TestChunkLayer_C11_BaseRebuildRecovery", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_c11_test.go", + "test": "TestChunkLayer_C11_BitmapPersistedBeforeWALRecycle", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_c11_test.go", + "test": "TestChunkLayer_C11_ExtentCallbackIsPureInMemory", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_c11_test.go", + "test": "TestChunkLayer_C11_IncrementalAfterRestart", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_c11_test.go", + "test": "TestChunkLayer_C11_LostOrMismatchedBitmapFallsBackToHashCompare", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_c11_test.go", + "test": "TestChunkLayer_C11_ReplicaApplyKeepsBitmap", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_c11_test.go", + "test": "TestChunkLayer_C11_RolloverKeepsPostCutDirt", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_c11_test.go", + "test": "TestChunkLayer_C11_SaveThenCheckpointFailureOverReportsOnly", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_bitmap_file_test.go", + "test": "TestChunkLayer_FileBitmapIncrementalAfterRestart", + "legacy_roots": [ + "NewFileChunkBitmapStore" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_fresh_bitmap_test.go", + "test": "TestChunkLayer_LostBitmapReconciles", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_precopy_test.go", + "test": "TestChunkPrecopy_LowerLSNApplyAfterStagingIsNotLost", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_precopy_test.go", + "test": "TestChunkPrecopy_RecoverAfterStagingInvalidatesTheStage", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_reconcile_test.go", + "test": "TestChunkReconcile_BaseInstallSupersedesRunningReconciliation", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_reconcile_test.go", + "test": "TestChunkReconcile_DetachDeadlineWhileReconciling", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_reconcile_test.go", + "test": "TestChunkReconcile_DetachWaitsForReconciliation", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_reconcile_test.go", + "test": "TestChunkReconcile_NoHeadMovesWhileReconciling", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_reconcile_test.go", + "test": "TestChunkReconcile_OldCompletionCannotCertifyReplacement", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_reconcile_test.go", + "test": "TestChunkReconcile_OldWorkerCannotModifyReplacementSet", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_reconcile_test.go", + "test": "TestChunkReconcile_ResultPersisted", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_reconcile_test.go", + "test": "TestChunkReconcile_UnpersistedResultKeepsReconciling", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_layer_reconcile_test.go", + "test": "TestChunkReconcile_WritesProceedWhileReconciling", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_restore_test.go", + "test": "TestClaimChunkHeadClearsProductionDetachProof", + "legacy_roots": [ + "NewFileChunkBitmapStore" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/flusher_test.go", + "test": "TestCrashFamily_AbruptKillAtMultipleWindows", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_bitmap_file_test.go", + "test": "TestFileChunkBitmapStore_CorruptStateIsLost", + "legacy_roots": [ + "NewFileChunkBitmapStore" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_bitmap_file_test.go", + "test": "TestFileChunkBitmapStore_RoundTripAndReopen", + "legacy_roots": [ + "NewFileChunkBitmapStore" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestFlusherCheckpointMetadataFailureDoesNotPublishOrRecycle", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/flusher_instrumentation_test.go", + "test": "TestFlusherInstrumentationCountsCheckpointFailure", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 one-superblock-write/one-sync counters and its raw injection seams; v3 record-stage counters are separate, no numerical equivalence claimed for metadata counts", + "v3_controls": [ + "TestFlusherV3ProfileCountsRealRecordStages", + "TestWALStoreV3_AutomaticCheckpointMetadataOrderAndRetry" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/flusher_instrumentation_test.go", + "test": "TestFlusherInstrumentationCountsCompleteCycle", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 one-superblock-write/one-sync counters and its raw injection seams; v3 record-stage counters are separate, no numerical equivalence claimed for metadata counts", + "v3_controls": [ + "TestFlusherV3ProfileCountsRealRecordStages", + "TestWALStoreV3_AutomaticCheckpointMetadataOrderAndRetry" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/flusher_instrumentation_test.go", + "test": "TestFlusherInstrumentationCountsWALReadFailures", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 one-superblock-write/one-sync counters and its raw injection seams; v3 record-stage counters are separate, no numerical equivalence claimed for metadata counts", + "v3_controls": [ + "TestFlusherV3ProfileCountsRealRecordStages", + "TestWALStoreV3_AutomaticCheckpointMetadataOrderAndRetry" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestFlusherRejectsCorruptOrUnsupportedDirtyRecord", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestFlusherSnapshotCannotOverwriteLaterDirectBase", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/flusher_snapshot_cut_test.go", + "test": "TestFlusherSnapshotCutPreservesSyncedWrites", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestFlusherWALSlotMismatchFailsClosed", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/flusher_test.go", + "test": "TestFlusher_AdvancesCheckpointBeforeReadFromExtent", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/flusher_test.go", + "test": "TestFlusher_ConcurrentWriteRaceLBAStaysFresh", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/flusher_test.go", + "test": "TestFlusher_ManyDirtyEntriesCheckpointStaysCorrect", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/flusher_test.go", + "test": "TestFlusher_RecoveryHonorsCheckpoint", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/flusher_test.go", + "test": "TestFlusher_ReleasesWALPressureAfterCheckpoint", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_restore_test.go", + "test": "TestFreshRestoreBitmapStartsAtClaimedHEAD", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery", + "v3_controls": [ + "TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint", + "TestChunkLayerV3_IgnoresProvidedLegacyBitmap", + "TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/flusher_test.go", + "test": "TestRecovery_DeterministicAcrossMultipleOpens", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestRunningFlusherCannotOverwriteDirectBase", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/chunk_frontier_test.go", + "test": "TestSeedChunkFrontierMetadataFailureRetry", + "legacy_roots": [ + "createLegacyWALStoreWithOptions", + "openLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3_AutomaticCheckpointMetadataOrderAndRetry", + "TestBlockMetadata_SeedFailureRetry" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_sync_generation_test.go", + "test": "TestWALGenerationBypassesUntrackedMutationPaths", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy sync cache/direct-mutation callback order; v3 success boundary is serialized and recovery-generation checked", + "v3_controls": [ + "TestWALStoreV3SyncRechecksTheFaultAtTheAckBoundary", + "TestWALStoreV3OuterSyncCompletionIsRefusedAcrossARecovery", + "TestWALStoreV3RecoverWaitsForABatchAckAndNothingRevivesTheCut" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_sync_frontier_order_test.go", + "test": "TestWALGenerationFirstCallerReturnOrdering", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy sync cache/direct-mutation callback order; v3 success boundary is serialized and recovery-generation checked", + "v3_controls": [ + "TestWALStoreV3SyncRechecksTheFaultAtTheAckBoundary", + "TestWALStoreV3OuterSyncCompletionIsRefusedAcrossARecovery", + "TestWALStoreV3RecoverWaitsForABatchAckAndNothingRevivesTheCut" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_sync_generation_test.go", + "test": "TestWALGenerationPartialAppendRecoverySync", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest" + ], + "reason": "legacy sync cache/direct-mutation callback order; v3 success boundary is serialized and recovery-generation checked", + "v3_controls": [ + "TestWALStoreV3SyncRechecksTheFaultAtTheAckBoundary", + "TestWALStoreV3OuterSyncCompletionIsRefusedAcrossARecovery", + "TestWALStoreV3RecoverWaitsForABatchAckAndNothingRevivesTheCut" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_multiblock_test.go", + "test": "TestWALMultiBlock_EncodeDecode", + "legacy_roots": [ + "decodeWALEntry" + ], + "reason": "v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound", + "v3_controls": [ + "TestWALStoreV3BatchRoundTripAcrossACrash", + "TestWALStoreV3TornBatchIsAllOrNothing", + "TestWALStoreV3InstrumentationIncludesBatch" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_persisted_tail_test.go", + "test": "TestWALStoreAppendDuringFlushThenTornWrapKeepsSyncedRecords", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest", + "readSuperblock" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_sticky_fsync_test.go", + "test": "TestWALStoreCheckpointFsyncFailureIsSticky", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_crash_linux_test.go", + "test": "TestWALStoreCheckpointSIGKILLCrashWindows", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestWALStoreClosePerformsFinalFlush", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestWALStoreCloseReturnsFinalMetadataFailure", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestWALStoreCloseWaitsForInflightSync", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_sticky_fsync_test.go", + "test": "TestWALStoreExtentFsyncFailureIsSticky", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_sticky_race_test.go", + "test": "TestWALStoreExtentFsyncFaultAfterThePublicationCheck", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "readSuperblock" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_sticky_race_test.go", + "test": "TestWALStoreExtentFsyncFaultDuringDirectFrontierPublication", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "readSuperblock" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_batch_lsn_reuse_test.go", + "test": "TestWALStoreFailedBatchAppendDoesNotRevertALaterAckedWrite", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound", + "v3_controls": [ + "TestWALStoreV3BatchRoundTripAcrossACrash", + "TestWALStoreV3TornBatchIsAllOrNothing", + "TestWALStoreV3InstrumentationIncludesBatch" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_persisted_tail_test.go", + "test": "TestWALStoreFlushPersistsTheReleasedTail", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "readSuperblock" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_sticky_race_test.go", + "test": "TestWALStoreFsyncsOfTheFileAreSerialized", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_persisted_tail_test.go", + "test": "TestWALStoreFullFlushThenTornWrapKeepsSyncedRecords", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_sticky_race_test.go", + "test": "TestWALStoreHeldWorkersSettleOnAFailurePath", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestWALStoreMutationAPIsRejectAfterClose", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_activation_test.go", + "test": "TestWALStoreProductionRefusesLegacyWithoutMutation", + "legacy_roots": [ + "createLegacyWALStoreWithOptions" + ], + "reason": "legacy input construction for the native public-refusal control itself; the production test stays on v3", + "v3_controls": [ + "TestWALStoreProductionRefusesLegacyWithoutMutation" + ], + "todo": "row 14a: replace only old input construction with frozen bytes; retain the production refusal control" + }, + { + "file": "core/storage/walstore_sticky_race_test.go", + "test": "TestWALStoreQueuedSyncAfterAFailedFsyncIsRefused", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_persisted_tail_test.go", + "test": "TestWALStoreRecoverBoundsPersistFailureRefusesAppendsUntilRetry", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest", + "readSuperblock" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_midhistory_hole_test.go", + "test": "TestWALStoreRecoverKeepsATornTail", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_recovery_frontier_gap_test.go", + "test": "TestWALStoreRecoverKeepsSyncedEntriesAboveAnUnpersistedFrontierJump", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest", + "readSuperblock" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_recovery_lww_test.go", + "test": "TestWALStoreRecoverLastWriterWinsAcrossScanOrder", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_persisted_tail_test.go", + "test": "TestWALStoreRecoverPersistsTheRecoveredBounds", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest", + "readSuperblock" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_recovery_hardening_test.go", + "test": "TestWALStoreRecoverReconstructsLegacyWrappedRetainedWindow", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_recovery_hardening_test.go", + "test": "TestWALStoreRecoverRejectsOverflowingBatchGeometry", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_legacy_trim_test.go", + "test": "TestWALStoreRecoverReplaysLegacyRangeTrim", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyReadOnlyForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_recovery_hardening_test.go", + "test": "TestWALStoreRecoverRetainsMultiBlockSuffixAcrossRestart", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_midhistory_hole_test.go", + "test": "TestWALStoreRecoverStaleReleasedGarbageKeepsRetainedData", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_midhistory_hole_test.go", + "test": "TestWALStoreRecoverSurvivesAnOutOfOrderUnsyncedTail", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_midhistory_hole_test.go", + "test": "TestWALStoreRecoverWarnsOnMidHistoryHole", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_midhistory_hole_test.go", + "test": "TestWALStoreRecoverWrappedHoleIsNoOutage", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_sticky_fsync_test.go", + "test": "TestWALStoreWALFsyncFailureIsSticky", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_sticky_race_test.go", + "test": "TestWALStoreWALFsyncFaultDuringCheckpointPublication", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest", + "readSuperblock" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_sticky_race_test.go", + "test": "TestWALStoreWritersQueuedBehindAFailedAppendAreRefused", + "legacy_roots": [ + "createLegacyWALStoreWithWALSizeForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_test.go", + "test": "TestWALStore_DirectFrontierMetadataFailureRetainsRetryState", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_multiblock_test.go", + "test": "TestWALStore_DisableAutoFlushForRecoveryTestPreservesReplayAfterCrash", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound", + "v3_controls": [ + "TestWALStoreV3BatchRoundTripAcrossACrash", + "TestWALStoreV3TornBatchIsAllOrNothing", + "TestWALStoreV3InstrumentationIncludesBatch" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_test.go", + "test": "TestWALStore_FailedAppendDoesNotConsumeLSN", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors", + "v3_controls": [ + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_multiblock_test.go", + "test": "TestWALStore_MultiBlockDirtyRead", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound", + "v3_controls": [ + "TestWALStoreV3BatchRoundTripAcrossACrash", + "TestWALStoreV3TornBatchIsAllOrNothing", + "TestWALStoreV3InstrumentationIncludesBatch" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_multiblock_test.go", + "test": "TestWALStore_MultiBlockFeatureDisabledByDefault", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound", + "v3_controls": [ + "TestWALStoreV3BatchRoundTripAcrossACrash", + "TestWALStoreV3TornBatchIsAllOrNothing", + "TestWALStoreV3InstrumentationIncludesBatch" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_multiblock_test.go", + "test": "TestWALStore_MultiBlockFlusherSplitsPerBlock", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound", + "v3_controls": [ + "TestWALStoreV3BatchRoundTripAcrossACrash", + "TestWALStoreV3TornBatchIsAllOrNothing", + "TestWALStoreV3InstrumentationIncludesBatch" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_multiblock_profile_test.go", + "test": "TestWALStore_MultiBlockProfile_RecordCountReduction", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound", + "v3_controls": [ + "TestWALStoreV3BatchRoundTripAcrossACrash", + "TestWALStoreV3TornBatchIsAllOrNothing", + "TestWALStoreV3InstrumentationIncludesBatch" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_multiblock_test.go", + "test": "TestWALStore_MultiBlockRecoverSplitsPerBlock", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound", + "v3_controls": [ + "TestWALStoreV3BatchRoundTripAcrossACrash", + "TestWALStoreV3TornBatchIsAllOrNothing", + "TestWALStoreV3InstrumentationIncludesBatch" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_multiblock_test.go", + "test": "TestWALStore_MultiBlockRecoveryHeadLSNUsesRecoveredFrontier", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound", + "v3_controls": [ + "TestWALStoreV3BatchRoundTripAcrossACrash", + "TestWALStoreV3TornBatchIsAllOrNothing", + "TestWALStoreV3InstrumentationIncludesBatch" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_multiblock_test.go", + "test": "TestWALStore_MultiBlockScanLBAsSplitsPerLSN", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound", + "v3_controls": [ + "TestWALStoreV3BatchRoundTripAcrossACrash", + "TestWALStoreV3TornBatchIsAllOrNothing", + "TestWALStoreV3InstrumentationIncludesBatch" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_retention_test.go", + "test": "TestWALStore_RecoveryRetention_Default_StrictRecycle", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots", + "v3_controls": [ + "TestWALStoreV3RecycleFloorCompatibilityMatrix", + "TestWALStoreV3RetentionCompatibilityMatrix", + "TestWALStoreV3ReclaimKeepsPartialBatchAndRetention" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_retention_test.go", + "test": "TestWALStore_RecoveryRetention_LargerThanCheckpoint_ClampsToZero", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots", + "v3_controls": [ + "TestWALStoreV3RecycleFloorCompatibilityMatrix", + "TestWALStoreV3RetentionCompatibilityMatrix", + "TestWALStoreV3ReclaimKeepsPartialBatchAndRetention" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_retention_test.go", + "test": "TestWALStore_RecoveryRetention_NonZero_WidensWindow", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots", + "v3_controls": [ + "TestWALStoreV3RecycleFloorCompatibilityMatrix", + "TestWALStoreV3RetentionCompatibilityMatrix", + "TestWALStoreV3ReclaimKeepsPartialBatchAndRetention" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_retention_test.go", + "test": "TestWALStore_RecoveryRetention_TypedFailureKind", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots", + "v3_controls": [ + "TestWALStoreV3RecycleFloorCompatibilityMatrix", + "TestWALStoreV3RetentionCompatibilityMatrix", + "TestWALStoreV3ReclaimKeepsPartialBatchAndRetention" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_recycle_pin_test.go", + "test": "TestWALStore_RecycleGate_FloorAboveProposed_NoClamp", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots", + "v3_controls": [ + "TestWALStoreV3RecycleFloorCompatibilityMatrix", + "TestWALStoreV3RetentionCompatibilityMatrix", + "TestWALStoreV3ReclaimKeepsPartialBatchAndRetention" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_recycle_pin_test.go", + "test": "TestWALStore_RecycleGate_FloorBelowCurrentCheckpoint_NoRegress", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots", + "v3_controls": [ + "TestWALStoreV3RecycleFloorCompatibilityMatrix", + "TestWALStoreV3RetentionCompatibilityMatrix", + "TestWALStoreV3ReclaimKeepsPartialBatchAndRetention" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_recycle_pin_test.go", + "test": "TestWALStore_RecycleGate_NilSource_LegacyBehavior", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots", + "v3_controls": [ + "TestWALStoreV3RecycleFloorCompatibilityMatrix", + "TestWALStoreV3RetentionCompatibilityMatrix", + "TestWALStoreV3ReclaimKeepsPartialBatchAndRetention" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_recycle_pin_test.go", + "test": "TestWALStore_RecycleGate_SetRecycleFloorSourceNil_Disables", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots", + "v3_controls": [ + "TestWALStoreV3RecycleFloorCompatibilityMatrix", + "TestWALStoreV3RetentionCompatibilityMatrix", + "TestWALStoreV3ReclaimKeepsPartialBatchAndRetention" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_recycle_pin_test.go", + "test": "TestWALStore_RecycleGate_SourceActive_ClampsAtFloor", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots", + "v3_controls": [ + "TestWALStoreV3RecycleFloorCompatibilityMatrix", + "TestWALStoreV3RetentionCompatibilityMatrix", + "TestWALStoreV3ReclaimKeepsPartialBatchAndRetention" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_recycle_pin_test.go", + "test": "TestWALStore_RecycleGate_SourceInactive_LegacyBehavior", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots", + "v3_controls": [ + "TestWALStoreV3RecycleFloorCompatibilityMatrix", + "TestWALStoreV3RetentionCompatibilityMatrix", + "TestWALStoreV3ReclaimKeepsPartialBatchAndRetention" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_format_admission_test.go", + "test": "TestWALStore_UnknownFormatWithoutFactoryRefused", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyReadOnlyForTest", + "openLegacyWALStoreForTest", + "readSuperblock" + ], + "reason": "raw frozen v2 codec/format fixtures remain; v3 has a distinct CRC32C/binding/dual-slot byte contract", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestDescriptorV3PublishAlternatesSlotsAndReopenSelectsNewest", + "TestWALStoreProductionRefusesLegacyWithoutMutation" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_persisted_tail_test.go", + "test": "TestWALWriterBatchReuseIsBoundedByTheDurableTail", + "legacy_roots": [ + "newWALWriter" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_persisted_tail_test.go", + "test": "TestWALWriterReuseIsBoundedByTheDurableTail", + "legacy_roots": [ + "newWALWriter" + ], + "reason": "raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes", + "v3_controls": [ + "TestWALIOV3_RealWriterReopenScan", + "TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes", + "TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash", + "TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestWriteExtentDirectFailureRetainsDirtyWAL", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestWriteExtentDirectSupersededWALDoesNotReappearAfterRestart", + "legacy_roots": [ + "createLegacyWALStoreForTest", + "openLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + }, + { + "file": "core/storage/walstore_checkpoint_safety_test.go", + "test": "TestWriteExtentDirectSupersedesPriorDirtyWAL", + "legacy_roots": [ + "createLegacyWALStoreForTest" + ], + "reason": "v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles", + "v3_controls": [ + "TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing", + "TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate", + "TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore", + "TestBaseInstallV3CompleteServesTheImageAcrossACrash" + ], + "todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b" + } +] diff --git a/seaweed-block/docs/design/format-v3-legacy-test-inventory.md b/seaweed-block/docs/design/format-v3-legacy-test-inventory.md new file mode 100644 index 0000000000..0a50760889 --- /dev/null +++ b/seaweed-block/docs/design/format-v3-legacy-test-inventory.md @@ -0,0 +1,140 @@ +# Temporary legacy test inventory at v3 activation + +Ruling: explicit test-only legacy constructors preserve old engine/bitmap controls until row 14a. Production Create/Open/readonly select v3, and v2 input is explicitly refused. `TestLegacyFixtureIsolation` checks that no default production source calls the private legacy constructor chain and that the storage transitive import closure excludes tool/test support. + +The JSON companion is the exact test inventory (including helper reachability), with each old control’s existing named v3 controls and its remaining format-specific scope. Constructor wrappers live in `_test.go`; cross-package migration fixture entry points exist only under `swblock_format_v3_test`. The real-v2 decoder/migration fixtures moved into that explicit tagged suite; raw codec table tests stay in the default suite. Full validation runs BOTH default and tagged suites. No frozen engine snapshot or test deletion is used. + +These mappings are coverage references, not a claim that different disk formats share identical mechanics. In particular v2 one-superblock metrics, permissive nonmonotone record scans and C11 bitmap-failure branches have no identical native-v3 branch. V3 instead uses the listed nonce/strict-order/BASE, map-proof and both-slot controls. The old controls remain executable until their row-14a disposition is reviewed. + +Public/format-neutral controls remain on production v3: durable provider capture/HEAD restore/readonly/status; auto probe/fallback; chunk C3/C4 upload races, typed admission, parallel workers; BASE priming and recovery lane controls; CRC-valid corrupt-batch rejection; acknowledged startup corruption refusal; pin/retention matrix driven by real writes. Initial UNKNOWN candidates and native batching expectations are explicit. The old warning-only startup test is replaced by `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness`; the old v2 warning scanner test remains in this inventory. + +TODO(row 14a): relocate or retire every listed legacy control explicitly; preserve raw migration input receipts and all named native controls. Do not treat this inventory as approval to remove a test or weaken an ACTIVE invariant. + +| Retained test | Reason | Existing native-v3 controls | +| --- | --- | --- | +| `cmd/sw-block/migrate_test.go::TestMigrateV3BadGeometryRefusedBeforeAnyWrite` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `cmd/sw-block/migrate_test.go::TestMigrateV3CleanVolume` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `cmd/sw-block/migrate_test.go::TestMigrateV3CrashAfterEachStepIsResumable` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `cmd/sw-block/migrate_format_v3_test.go::TestMigrateV3ExcludesOpenUntilCommitFinishes` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `cmd/sw-block/migrate_test.go::TestMigrateV3NeverRestoresTheBackup` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `cmd/sw-block/migrate_test.go::TestMigrateV3OldBinaryAfterPreparation` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `cmd/sw-block/migrate_test.go::TestMigrateV3OldWALOverwritesThePreparedSlot` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `cmd/sw-block/migrate_format_v3_test.go::TestMigrateV3PreparedOnlyRefusedByV3Open` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `cmd/sw-block/migrate_test.go::TestMigrateV3RefusalsChangeNothing` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `cmd/sw-block/migrate_test.go::TestMigrateV3RetirementRerunFsyncsTheDirectory` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `cmd/sw-block/migrate_format_v3_test.go::TestMigrateV3VolumeOpensAsV3` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `cmd/sw-block/internal/v2legacy/real_store_legacy_test.go::TestReadSuperblockRefusesOtherFormats` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `cmd/sw-block/internal/v2legacy/real_store_legacy_test.go::TestScanCleanOnRealV2Stores` | real v2 input fixture for the frozen decoder/migration; row 14a replaces construction, not migration refusal coverage | `TestMigrateV3VolumeOpensAsV3`, `TestMigrateV3PreparedOnlyRefusedByV3Open` | +| `core/storage/flusher_test.go::TestAllBlocks_ReturnsBlocksAfterFlush` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/walstore_checkpoint_safety_test.go::TestCheckpointPublicationCrashWindowsRemainRecoverable` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/chunk_layer_typed_cause_test.go::TestChunkCut_BaseInstallRefusalIsTyped` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_typed_cause_test.go::TestChunkCut_CASLostToMovedHeadIsHeadConflict` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_typed_cause_test.go::TestChunkCut_ClosedLayerIsTyped` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_precopy_test.go::TestChunkCut_RecoverWaitsForTheCaptureBarrier` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_lsn_order_test.go::TestChunkCut_RemoteLSNNeverDecreases` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_typed_cause_test.go::TestChunkCut_UploadFailureIsRemoteUnavailable` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_c11_test.go::TestChunkLayer_C11_BaseRebuildRecovery` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_c11_test.go::TestChunkLayer_C11_BitmapPersistedBeforeWALRecycle` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_c11_test.go::TestChunkLayer_C11_ExtentCallbackIsPureInMemory` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_c11_test.go::TestChunkLayer_C11_IncrementalAfterRestart` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_c11_test.go::TestChunkLayer_C11_LostOrMismatchedBitmapFallsBackToHashCompare` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_c11_test.go::TestChunkLayer_C11_ReplicaApplyKeepsBitmap` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_c11_test.go::TestChunkLayer_C11_RolloverKeepsPostCutDirt` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_c11_test.go::TestChunkLayer_C11_SaveThenCheckpointFailureOverReportsOnly` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_bitmap_file_test.go::TestChunkLayer_FileBitmapIncrementalAfterRestart` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_fresh_bitmap_test.go::TestChunkLayer_LostBitmapReconciles` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_precopy_test.go::TestChunkPrecopy_LowerLSNApplyAfterStagingIsNotLost` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_precopy_test.go::TestChunkPrecopy_RecoverAfterStagingInvalidatesTheStage` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_reconcile_test.go::TestChunkReconcile_BaseInstallSupersedesRunningReconciliation` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_reconcile_test.go::TestChunkReconcile_DetachDeadlineWhileReconciling` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_reconcile_test.go::TestChunkReconcile_DetachWaitsForReconciliation` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_reconcile_test.go::TestChunkReconcile_NoHeadMovesWhileReconciling` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_reconcile_test.go::TestChunkReconcile_OldCompletionCannotCertifyReplacement` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_reconcile_test.go::TestChunkReconcile_OldWorkerCannotModifyReplacementSet` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_reconcile_test.go::TestChunkReconcile_ResultPersisted` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_reconcile_test.go::TestChunkReconcile_UnpersistedResultKeepsReconciling` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_layer_reconcile_test.go::TestChunkReconcile_WritesProceedWhileReconciling` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_restore_test.go::TestClaimChunkHeadClearsProductionDetachProof` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/flusher_test.go::TestCrashFamily_AbruptKillAtMultipleWindows` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/chunk_bitmap_file_test.go::TestFileChunkBitmapStore_CorruptStateIsLost` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/chunk_bitmap_file_test.go::TestFileChunkBitmapStore_RoundTripAndReopen` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/walstore_checkpoint_safety_test.go::TestFlusherCheckpointMetadataFailureDoesNotPublishOrRecycle` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/flusher_instrumentation_test.go::TestFlusherInstrumentationCountsCheckpointFailure` | v2 one-superblock-write/one-sync counters and its raw injection seams; v3 record-stage counters are separate, no numerical equivalence claimed for metadata counts | `TestFlusherV3ProfileCountsRealRecordStages`, `TestWALStoreV3_AutomaticCheckpointMetadataOrderAndRetry` | +| `core/storage/flusher_instrumentation_test.go::TestFlusherInstrumentationCountsCompleteCycle` | v2 one-superblock-write/one-sync counters and its raw injection seams; v3 record-stage counters are separate, no numerical equivalence claimed for metadata counts | `TestFlusherV3ProfileCountsRealRecordStages`, `TestWALStoreV3_AutomaticCheckpointMetadataOrderAndRetry` | +| `core/storage/flusher_instrumentation_test.go::TestFlusherInstrumentationCountsWALReadFailures` | v2 one-superblock-write/one-sync counters and its raw injection seams; v3 record-stage counters are separate, no numerical equivalence claimed for metadata counts | `TestFlusherV3ProfileCountsRealRecordStages`, `TestWALStoreV3_AutomaticCheckpointMetadataOrderAndRetry` | +| `core/storage/walstore_checkpoint_safety_test.go::TestFlusherRejectsCorruptOrUnsupportedDirtyRecord` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_checkpoint_safety_test.go::TestFlusherSnapshotCannotOverwriteLaterDirectBase` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/flusher_snapshot_cut_test.go::TestFlusherSnapshotCutPreservesSyncedWrites` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/walstore_checkpoint_safety_test.go::TestFlusherWALSlotMismatchFailsClosed` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/flusher_test.go::TestFlusher_AdvancesCheckpointBeforeReadFromExtent` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/flusher_test.go::TestFlusher_ConcurrentWriteRaceLBAStaysFresh` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/flusher_test.go::TestFlusher_ManyDirtyEntriesCheckpointStaysCorrect` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/flusher_test.go::TestFlusher_RecoveryHonorsCheckpoint` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/flusher_test.go::TestFlusher_ReleasesWALPressureAfterCheckpoint` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/chunk_restore_test.go::TestFreshRestoreBitmapStartsAtClaimedHEAD` | legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery | `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation` | +| `core/storage/flusher_test.go::TestRecovery_DeterministicAcrossMultipleOpens` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/walstore_checkpoint_safety_test.go::TestRunningFlusherCannotOverwriteDirectBase` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/chunk_frontier_test.go::TestSeedChunkFrontierMetadataFailureRetry` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3_AutomaticCheckpointMetadataOrderAndRetry`, `TestBlockMetadata_SeedFailureRetry` | +| `core/storage/walstore_sync_generation_test.go::TestWALGenerationBypassesUntrackedMutationPaths` | legacy sync cache/direct-mutation callback order; v3 success boundary is serialized and recovery-generation checked | `TestWALStoreV3SyncRechecksTheFaultAtTheAckBoundary`, `TestWALStoreV3OuterSyncCompletionIsRefusedAcrossARecovery`, `TestWALStoreV3RecoverWaitsForABatchAckAndNothingRevivesTheCut` | +| `core/storage/walstore_sync_frontier_order_test.go::TestWALGenerationFirstCallerReturnOrdering` | legacy sync cache/direct-mutation callback order; v3 success boundary is serialized and recovery-generation checked | `TestWALStoreV3SyncRechecksTheFaultAtTheAckBoundary`, `TestWALStoreV3OuterSyncCompletionIsRefusedAcrossARecovery`, `TestWALStoreV3RecoverWaitsForABatchAckAndNothingRevivesTheCut` | +| `core/storage/walstore_sync_generation_test.go::TestWALGenerationPartialAppendRecoverySync` | legacy sync cache/direct-mutation callback order; v3 success boundary is serialized and recovery-generation checked | `TestWALStoreV3SyncRechecksTheFaultAtTheAckBoundary`, `TestWALStoreV3OuterSyncCompletionIsRefusedAcrossARecovery`, `TestWALStoreV3RecoverWaitsForABatchAckAndNothingRevivesTheCut` | +| `core/storage/walstore_multiblock_test.go::TestWALMultiBlock_EncodeDecode` | v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound | `TestWALStoreV3BatchRoundTripAcrossACrash`, `TestWALStoreV3TornBatchIsAllOrNothing`, `TestWALStoreV3InstrumentationIncludesBatch` | +| `core/storage/walstore_persisted_tail_test.go::TestWALStoreAppendDuringFlushThenTornWrapKeepsSyncedRecords` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_sticky_fsync_test.go::TestWALStoreCheckpointFsyncFailureIsSticky` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_checkpoint_crash_linux_test.go::TestWALStoreCheckpointSIGKILLCrashWindows` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/walstore_checkpoint_safety_test.go::TestWALStoreClosePerformsFinalFlush` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_checkpoint_safety_test.go::TestWALStoreCloseReturnsFinalMetadataFailure` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_checkpoint_safety_test.go::TestWALStoreCloseWaitsForInflightSync` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_sticky_fsync_test.go::TestWALStoreExtentFsyncFailureIsSticky` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_sticky_race_test.go::TestWALStoreExtentFsyncFaultAfterThePublicationCheck` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_sticky_race_test.go::TestWALStoreExtentFsyncFaultDuringDirectFrontierPublication` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_batch_lsn_reuse_test.go::TestWALStoreFailedBatchAppendDoesNotRevertALaterAckedWrite` | v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound | `TestWALStoreV3BatchRoundTripAcrossACrash`, `TestWALStoreV3TornBatchIsAllOrNothing`, `TestWALStoreV3InstrumentationIncludesBatch` | +| `core/storage/walstore_persisted_tail_test.go::TestWALStoreFlushPersistsTheReleasedTail` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_sticky_race_test.go::TestWALStoreFsyncsOfTheFileAreSerialized` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_persisted_tail_test.go::TestWALStoreFullFlushThenTornWrapKeepsSyncedRecords` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_sticky_race_test.go::TestWALStoreHeldWorkersSettleOnAFailurePath` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_checkpoint_safety_test.go::TestWALStoreMutationAPIsRejectAfterClose` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_activation_test.go::TestWALStoreProductionRefusesLegacyWithoutMutation` | legacy input construction for the native public-refusal control itself; the production test stays on v3 | `TestWALStoreProductionRefusesLegacyWithoutMutation` | +| `core/storage/walstore_sticky_race_test.go::TestWALStoreQueuedSyncAfterAFailedFsyncIsRefused` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_persisted_tail_test.go::TestWALStoreRecoverBoundsPersistFailureRefusesAppendsUntilRetry` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_midhistory_hole_test.go::TestWALStoreRecoverKeepsATornTail` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_recovery_frontier_gap_test.go::TestWALStoreRecoverKeepsSyncedEntriesAboveAnUnpersistedFrontierJump` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_recovery_lww_test.go::TestWALStoreRecoverLastWriterWinsAcrossScanOrder` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_persisted_tail_test.go::TestWALStoreRecoverPersistsTheRecoveredBounds` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_recovery_hardening_test.go::TestWALStoreRecoverReconstructsLegacyWrappedRetainedWindow` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_recovery_hardening_test.go::TestWALStoreRecoverRejectsOverflowingBatchGeometry` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_legacy_trim_test.go::TestWALStoreRecoverReplaysLegacyRangeTrim` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/walstore_recovery_hardening_test.go::TestWALStoreRecoverRetainsMultiBlockSuffixAcrossRestart` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_midhistory_hole_test.go::TestWALStoreRecoverStaleReleasedGarbageKeepsRetainedData` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_midhistory_hole_test.go::TestWALStoreRecoverSurvivesAnOutOfOrderUnsyncedTail` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_midhistory_hole_test.go::TestWALStoreRecoverWarnsOnMidHistoryHole` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_midhistory_hole_test.go::TestWALStoreRecoverWrappedHoleIsNoOutage` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_sticky_fsync_test.go::TestWALStoreWALFsyncFailureIsSticky` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_sticky_race_test.go::TestWALStoreWALFsyncFaultDuringCheckpointPublication` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_sticky_race_test.go::TestWALStoreWritersQueuedBehindAFailedAppendAreRefused` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_test.go::TestWALStore_DirectFrontierMetadataFailureRetainsRetryState` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/walstore_multiblock_test.go::TestWALStore_DisableAutoFlushForRecoveryTestPreservesReplayAfterCrash` | v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound | `TestWALStoreV3BatchRoundTripAcrossACrash`, `TestWALStoreV3TornBatchIsAllOrNothing`, `TestWALStoreV3InstrumentationIncludesBatch` | +| `core/storage/walstore_test.go::TestWALStore_FailedAppendDoesNotConsumeLSN` | v2 engine/layout, forced legacy fields or callback seams; v3 uses coherent descriptors | `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | +| `core/storage/walstore_multiblock_test.go::TestWALStore_MultiBlockDirtyRead` | v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound | `TestWALStoreV3BatchRoundTripAcrossACrash`, `TestWALStoreV3TornBatchIsAllOrNothing`, `TestWALStoreV3InstrumentationIncludesBatch` | +| `core/storage/walstore_multiblock_test.go::TestWALStore_MultiBlockFeatureDisabledByDefault` | v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound | `TestWALStoreV3BatchRoundTripAcrossACrash`, `TestWALStoreV3TornBatchIsAllOrNothing`, `TestWALStoreV3InstrumentationIncludesBatch` | +| `core/storage/walstore_multiblock_test.go::TestWALStore_MultiBlockFlusherSplitsPerBlock` | v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound | `TestWALStoreV3BatchRoundTripAcrossACrash`, `TestWALStoreV3TornBatchIsAllOrNothing`, `TestWALStoreV3InstrumentationIncludesBatch` | +| `core/storage/walstore_multiblock_profile_test.go::TestWALStore_MultiBlockProfile_RecordCountReduction` | v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound | `TestWALStoreV3BatchRoundTripAcrossACrash`, `TestWALStoreV3TornBatchIsAllOrNothing`, `TestWALStoreV3InstrumentationIncludesBatch` | +| `core/storage/walstore_multiblock_test.go::TestWALStore_MultiBlockRecoverSplitsPerBlock` | v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound | `TestWALStoreV3BatchRoundTripAcrossACrash`, `TestWALStoreV3TornBatchIsAllOrNothing`, `TestWALStoreV3InstrumentationIncludesBatch` | +| `core/storage/walstore_multiblock_test.go::TestWALStore_MultiBlockRecoveryHeadLSNUsesRecoveredFrontier` | v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound | `TestWALStoreV3BatchRoundTripAcrossACrash`, `TestWALStoreV3TornBatchIsAllOrNothing`, `TestWALStoreV3InstrumentationIncludesBatch` | +| `core/storage/walstore_multiblock_test.go::TestWALStore_MultiBlockScanLBAsSplitsPerLSN` | v2 opt-in batch framing/failure injection; v3 batch is native and nonce-bound | `TestWALStoreV3BatchRoundTripAcrossACrash`, `TestWALStoreV3TornBatchIsAllOrNothing`, `TestWALStoreV3InstrumentationIncludesBatch` | +| `core/storage/walstore_retention_test.go::TestWALStore_RecoveryRetention_Default_StrictRecycle` | fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots | `TestWALStoreV3RecycleFloorCompatibilityMatrix`, `TestWALStoreV3RetentionCompatibilityMatrix`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention` | +| `core/storage/walstore_retention_test.go::TestWALStore_RecoveryRetention_LargerThanCheckpoint_ClampsToZero` | fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots | `TestWALStoreV3RecycleFloorCompatibilityMatrix`, `TestWALStoreV3RetentionCompatibilityMatrix`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention` | +| `core/storage/walstore_retention_test.go::TestWALStore_RecoveryRetention_NonZero_WidensWindow` | fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots | `TestWALStoreV3RecycleFloorCompatibilityMatrix`, `TestWALStoreV3RetentionCompatibilityMatrix`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention` | +| `core/storage/walstore_retention_test.go::TestWALStore_RecoveryRetention_TypedFailureKind` | fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots | `TestWALStoreV3RecycleFloorCompatibilityMatrix`, `TestWALStoreV3RetentionCompatibilityMatrix`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention` | +| `core/storage/walstore_recycle_pin_test.go::TestWALStore_RecycleGate_FloorAboveProposed_NoClamp` | fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots | `TestWALStoreV3RecycleFloorCompatibilityMatrix`, `TestWALStoreV3RetentionCompatibilityMatrix`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention` | +| `core/storage/walstore_recycle_pin_test.go::TestWALStore_RecycleGate_FloorBelowCurrentCheckpoint_NoRegress` | fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots | `TestWALStoreV3RecycleFloorCompatibilityMatrix`, `TestWALStoreV3RetentionCompatibilityMatrix`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention` | +| `core/storage/walstore_recycle_pin_test.go::TestWALStore_RecycleGate_NilSource_LegacyBehavior` | fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots | `TestWALStoreV3RecycleFloorCompatibilityMatrix`, `TestWALStoreV3RetentionCompatibilityMatrix`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention` | +| `core/storage/walstore_recycle_pin_test.go::TestWALStore_RecycleGate_SetRecycleFloorSourceNil_Disables` | fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots | `TestWALStoreV3RecycleFloorCompatibilityMatrix`, `TestWALStoreV3RetentionCompatibilityMatrix`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention` | +| `core/storage/walstore_recycle_pin_test.go::TestWALStore_RecycleGate_SourceActive_ClampsAtFloor` | fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots | `TestWALStoreV3RecycleFloorCompatibilityMatrix`, `TestWALStoreV3RetentionCompatibilityMatrix`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention` | +| `core/storage/walstore_recycle_pin_test.go::TestWALStore_RecycleGate_SourceInactive_LegacyBehavior` | fabricated v2 checkpoint/retention geometry; v3 replacement drives real acknowledged writes and both slots | `TestWALStoreV3RecycleFloorCompatibilityMatrix`, `TestWALStoreV3RetentionCompatibilityMatrix`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention` | +| `core/storage/walstore_format_admission_test.go::TestWALStore_UnknownFormatWithoutFactoryRefused` | raw frozen v2 codec/format fixtures remain; v3 has a distinct CRC32C/binding/dual-slot byte contract | `TestWALIOV3_RealWriterReopenScan`, `TestDescriptorV3PublishAlternatesSlotsAndReopenSelectsNewest`, `TestWALStoreProductionRefusesLegacyWithoutMutation` | +| `core/storage/walstore_persisted_tail_test.go::TestWALWriterBatchReuseIsBoundedByTheDurableTail` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_persisted_tail_test.go::TestWALWriterReuseIsBoundedByTheDurableTail` | raw v2 header/window/IEEE-CRC/permissive scan assumptions; native v3 refuses holes below W and fences rolled-back suffixes | `TestWALIOV3_RealWriterReopenScan`, `TestWALStoreV3RecoversEveryAcknowledgedWriteInBothModes`, `TestWALStoreV3DroppedRecordsNeverResurfaceAfterASecondCrash`, `TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness` | +| `core/storage/walstore_checkpoint_safety_test.go::TestWriteExtentDirectFailureRetainsDirtyWAL` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_checkpoint_safety_test.go::TestWriteExtentDirectSupersededWALDoesNotReappearAfterRestart` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | +| `core/storage/walstore_checkpoint_safety_test.go::TestWriteExtentDirectSupersedesPriorDirtyWAL` | v2 fd/callback/checkpoint injection or direct-extent API; v3 fails through the shared publisher/owned map and uses install handles | `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestBaseInstallV3CompleteServesTheImageAcrossACrash` | diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index 8c4b976479..98a5da5d3a 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -53,17 +53,17 @@ stateDiagram-v2 | From | To | Guard | Enforced in | Protects | |---|---|---|---|---| -| — | Opened | superblock valid and of the configured engine kind; the backend starts not operational | `core/storage/walstore.go` `OpenWALStoreWithOptions`; `core/frontend/durable/provider.go` `openOrCreate` | `INV-WAL-OPGATE-001` | +| — | Opened | v3 A/B descriptors and owned-map dependencies valid, exclusive file ownership acquired; legacy formats refused; backend starts not operational | `core/storage/walstore.go` `OpenWALStoreWithOptions`; `core/frontend/durable/provider.go` `openOrCreate` | `INV-WAL-OPGATE-001` | | Opened | Recovering | the volume is open in the provider | `core/frontend/durable/provider.go` `RecoverVolume` | `INV-WAL-OPGATE-001` | -| Recovering | Serving | replay by LSN from the persisted `[tail, head)` succeeds and the rebuilt bounds are persisted before any append; `Recover` holds the capture barrier | `core/storage/recovery.go` `recoverWAL`; `core/storage/walstore.go` `WALStore.Recover` | `INV-WAL-SYNCED-RECOVERED-001`, `INV-WAL-REPLAY-LWW-001`, `INV-WAL-FRONTIER-GAP-001`, `INV-CUT-RECOVER-BARRIER-001` | +| Recovering | Serving | v3 nonce/cursor-bound physical prefix satisfies its W/BASE gate; rollback fence and rebuilt bounds publish before reuse; `Recover` holds the capture barrier and invalidates proofs at start/end (legacy LSN scan remains fixture-only) | `core/storage/walstore_v3.go` `recoverV3`; `core/storage/walstore.go` `WALStore.Recover` | `INV-WAL-SYNCED-RECOVERED-001`, `INV-WAL-REPLAY-LWW-001`, `INV-WAL-FRONTIER-GAP-001`, `INV-CUT-RECOVER-BARRIER-001` | | Recovering | RecoveryFailed | a WAL integrity failure or an I/O error; the backend stays not operational and the host blocks local readiness with `wal_corrupt` or `io_error` | `cmd/blockvolume/durable_startup.go` `openAndRecoverDurable`; `core/host/volume/recovery_watchdog.go` `LocalRecoveryHealthReason` | `INV-WAL-TYPED-FAILCLOSED-001`, `INV-WAL-OPGATE-001` | | Serving | Serving | each `Read`, `Write`, `Sync` passes the operational, chunk-fence and lineage checks; a write is durable only when a covering `Sync` returns | `core/frontend/durable/storage_adapter.go` `gate`; `core/storage/walstore.go` `WALStore.Sync` | `INV-FE-LINEAGE-GATE-001`, `INV-WAL-SYNC-FRONTIER-001`, `INV-FE-FUA-SYNC-001`, `INV-FE-FLUSH-SYNC-001` | -| Serving | Serving (checkpoint) | the flusher snapshots the whole dirty map; the chunk bitmap is durable first; the superblock with the new checkpoint and released tail is fsynced before the writer may reuse the bytes | `core/storage/flusher.go` `flushOnceInternal`; `core/storage/walstore.go` `persistCheckpointReleasing` | `INV-WAL-CHECKPOINT-SNAPSHOT-001`, `INV-WAL-REUSE-PERSISTED-TAIL-001`, `INV-WAL-CKPT-META-FAIL-001`, `INV-CUT-BITMAP-001` | +| Serving | Serving (checkpoint) | the flusher binds its snapshot/materialization to one recovery lifetime; extent and owned COW map are durable before the shared descriptor publisher advances checkpoint/tail; both slot tails pin reuse (C11 bitmap/superblock path remains legacy-fixture-only) | `core/storage/flusher.go` `flushOnceInternal`; `core/storage/walstore_map_checkpoint_v3.go` `publishCheckpointV3` | `INV-WAL-CHECKPOINT-SNAPSHOT-001`, `INV-WAL-REUSE-PERSISTED-TAIL-001`, `INV-WAL-CKPT-META-FAIL-001`, `INV-CUT-BITMAP-001` | | Serving | FaultLatched | the first failed `fsync` of the store file, or a WAL append whose write failed | `core/storage/walstore.go` `noteFsyncFailure`, `noteAppendFailure`, `syncFile` | `INV-WAL-FSYNC-STICKY-001`, `INV-WAL-APPEND-STICKY-001` | | FaultLatched | FaultLatched | every later `Sync`, write, checkpoint and `Recover` on the same open store is refused | `core/storage/walstore.go` `stickyIOFault` | `INV-WAL-FSYNC-STICKY-001` | | any | Closed | `Close`; a store with a latched fault does not write the final superblock | `core/storage/walstore.go` `WALStore.Close` | — | -The format-v3 record codec (plan row 2) is dark: no production M1 transition selects it yet. Its framing/validation boundary is tested separately (`INV-WAL-V3-RECORD-001`); writer/cursor/lap admission and production activation land in later ordered rows. Existing machine diagrams and ACTIVE recovery guards are unchanged. Before reading v3 slots, both read/write and offline read-only open acquire an exclusive nonblocking file lock; the offline migration CLI acquires the same lock before any descriptor read or mutation (`INV-WAL-V3-OWNER-001`). Contention refuses open/migration without changing bytes; descriptor close or process exit releases ownership. This implements the existing offline-migration precondition, not a new serving state. The mapped v3 checkpoint also carries a complete-record physical tail through the covered LSN minus the configured retention window; partial batches remain retained. The existing sole publisher then performs metadata-only rollover when the fallback still pins that prefix. Reuse still requires both valid same-nonce slot tails and retirement of checkpointed dirty references under writer exclusion; idle, unchanged-checkpoint and admission paths also settle a pinned fallback. An unlocked catch-up scan revalidates the coherent checkpoint and tail before emitting anything. A failed rollover latches and grants no reuse (`INV-WAL-V3-RECLAIM-001`). +Public walstore Create now selects mapped format v3/impl3 (mode C by default, mode A by create option). Open and offline readonly use A/B slot and owned-map validation; valid legacy formats are refused with `ErrUnsupportedLegacyFormat`, rather than silently retrofitted. The temporary old-engine/raw-codec test scope and every named native replacement are recorded in [the legacy inventory](format-v3-legacy-test-inventory.md). Native recovery validates nonce/cursor binding and a contiguous physical LSN prefix before applying the mode-specific W rule; an acknowledged-range integrity failure blocks startup. The provider's create geometry, auto probe, capture, HEAD restore and readonly/status controls exercise the public selector (`INV-WAL-V3-ACTIVATION-001`). Before reading v3 slots, both read/write and offline read-only open acquire an exclusive nonblocking file lock; the offline migration CLI acquires the same lock before any descriptor read or mutation (`INV-WAL-V3-OWNER-001`). Contention refuses open/migration without changing bytes; descriptor close or process exit releases ownership. This implements the existing offline-migration precondition, not a new serving state. The mapped v3 checkpoint also carries a complete-record physical tail through the covered LSN minus the configured retention window; partial batches remain retained. The existing sole publisher then performs metadata-only rollover when the fallback still pins that prefix. Reuse still requires both valid same-nonce slot tails and retirement of checkpointed dirty references under writer exclusion; idle, unchanged-checkpoint and admission paths also settle a pinned fallback. An unlocked catch-up scan revalidates the coherent checkpoint and tail before emitting anything. A failed rollover latches and grants no reuse (`INV-WAL-V3-RECLAIM-001`). Recovery warnings such as `wal_hole_suspected` are recorded in Serving without changing health (`INV-WAL-WARN-NO-HEALTH-001`). The open gaps of this machine (a corrupted synced record mid-history only warns; forged records in user data) are listed in the [core known issues](block-design.md#24-known-issues-and-work-in-progress) and are not ledger rows. @@ -278,14 +278,17 @@ The "Machine / transition" column refers to Part A. Notes under a table record w | `INV-WAL-SYNC-FRONTIER-001` | `Sync` never reports an uncovered write durable: it returns the global synced frontier, which is at least the caller's own write and is covered by a completed `fsync`. It may include later writes whose covering `fsync` completed before the caller resumed. | M1 write lifecycle: Appended → Synced | `core/storage/walstore.go` `WALStore.Sync` | `TestWALStore_SyncDoesNotClaimConcurrentWrite` (`core/storage/walstore_test.go`); `TestWALGenerationFirstCallerReturnOrdering` (`core/storage/walstore_sync_frontier_order_test.go`) | — | ACTIVE | | `INV-WAL-TYPED-FAILCLOSED-001` | A corrupt replay at startup is reported as `wal_corrupt` at once and keeps local readiness blocked. | M1 Recovering → RecoveryFailed | `cmd/blockvolume/durable_startup.go` `openAndRecoverDurable`; `core/host/volume/recovery_watchdog.go` `LocalRecoveryHealthReason` | `TestDurableStartup_RealProviderCorruptReplayIsWALCorrupt` (`cmd/blockvolume/durable_startup_test.go`); `TestLocalRecoveryFailure_CorruptWALReportsWALCorruptAtOnce` (`core/host/volume/recovery_typed_reason_test.go`) | — | ACTIVE | | `INV-WAL-WARN-NO-HEALTH-001` | Recovery warnings (for example `wal_hole_suspected`) appear in status without changing health or eligibility. | M1 Serving | `core/host/volume/status_server.go` `statusProjection` | `TestStatusServer_StatusCarriesRecoveryWarningsWithoutChangingHealth` (`core/host/volume/status_warnings_test.go`) | — | ACTIVE | +| `INV-WAL-V3-ACTIVATION-001` | Public create produces an owned mapped v3/impl3 volume with the requested chunk geometry and C default/A option. Writable/readonly open validate A/B dependencies, reject actual legacy headers without mutation, and can select a valid fallback when A is damaged. Production provider capture/HEAD restore/status use those selectors. Legacy fixture constructors cannot be called by default production code or enter its transitive storage import closure. | M1 open/create/readonly | `walstore.go` public selectors; `walstore_v3.go` `refuseLegacyWALStore`, `ProbeWALStoreV3`; `provider.go` | `TestWALStoreProductionSelectorCreatesMappedV3`, `TestWALStoreProductionRefusesLegacyWithoutMutation`, `TestWALStoreProductionFallsBackWhenDamagedSlotOnlyLooksLegacy`, `TestWALStoreProductionCreateOptions`, `TestLegacyFixtureIsolation`, `TestDurableProviderV3_HEADRestorePreservesRemoteImageAndNextLSN`, `TestDurableProviderV3_StatusTracksRecoverSyncAndCapture` | Selector wiring only; native protocol remains the accepted composed format model, not a new model proof | ACTIVE | +| `INV-WAL-V3-FLUSH-PROFILE-001` | Native flusher header/full-record/decode counters describe actual reads and validation; I/O failure is distinct from validation failure and only successfully materialized blocks count validated. | M1 checkpoint instrumentation | `walstore_v3.go` `readWholeRecordProfiledV3`, `readDirtyRecordV3` | `TestFlusherV3ProfileCountsRealRecordStages` | Observability; no durability transition change | ACTIVE | +| `INV-WAL-V3-CAPTURE-CANDIDATES-001` | A retained WAL entry already covered by HEAD is not dirt since HEAD. New post-HEAD WAL entries, UNKNOWN map chunks and map max-LSN above HEAD remain capture candidates. | M5 candidate selection | `chunk_layer.go` `captureCandidates` | `TestChunkLayerV3CapturedUncheckpointedWALIsCleanUntilRewritten`, `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestBaseInstallV3CompletePersistsTheMapUnknownOfBaseWrites` | Conservative reachability unchanged; narrower redundant work | ACTIVE | | `INV-WAL-V3-DESCRIPTOR-001` | A v3 descriptor slot is used only if it is valid. It needs a matching CRC32C (Castagnoli), every reserved byte zero, an accepted impl, a nonzero slotGen at most 2^64-2 and a nonzero nonce. Its geometry must be consistent with checked arithmetic, its BASE fields must follow their per-state rules, and CheckpointLSN ≤ mapCoveredCheckpoint ≤ W must hold. Of the two slots, the valid selectable one with the higher slotGen wins. A prepared migration slot is never selected. Equal generations with different bytes, or slots that disagree on identity or geometry, are refused. | M1 Opened (v3 descriptor selection) | `core/storage/superblock_v3.go` `decodeSlotV3`, `selectSlotV3`, `nextSlotGenV3` | `TestSlotV3VectorsDecodeAsExpected`, `TestSlotV3Selection`, `TestSlotV3CounterExhaustion`, `TestSlotV3InstalledMayHaveCursorBelowTail` (`core/storage/superblock_v3_test.go`) | — | STUB | -| `INV-WAL-V3-RECORD-001` | A dark impl-3 record codec uses the fixed 62-byte prefix and 70-byte overhead, CRC32C and an explicit EntrySize. It refuses unknown types/flags, a zero nonce, invalid per-type geometry, overflowing count/LSN/cursor or LBA spans, nonzero padding, bad CRC/footer and truncation before allocating a payload. Codec success alone is not nonce/cursor/lap replay admission. | M1 (v3 codec only; no production transition yet) | `core/storage/wal_entry_v3.go` `payloadSizeV3`, `encodeWALEntryV3`, `decodeWALEntryV3` | `TestWALEntryV3_CanonicalBarrierBytes`, `TestWALEntryV3_TypeFootprints`, `TestWALEntryV3_RefusesInvalidEncode`, `TestWALEntryV3_RefusesMalformedWire`, `FuzzWALEntryV3_DecodeNeverPanics` | `WALRecovery` abstract record validity; physical byte rules are code-test obligations | STUB | -| `INV-WAL-V3-LSN-ORDER-001` | A dark v3 writer accepts only a first LSN above its highest consumed LSN; a batch consumes its whole validated range. Equal/lower requests return ErrWALLSNOrder before any pwrite or cursor change. Constructor coverage and a recovered kept frontier count as consumed; a fenced-away suffix does not. | M1 (dark append only) | `core/storage/wal_io_v3.go` `append`, `newWALWriterV3`, `restoreScanV3` | `TestWALLSNOrderV3_RefusesDuplicateAndLower`, `TestWALLSNOrderV3_BatchConsumesFullRange`, `TestWALLSNOrderV3_RestoreUsesKeptNotDroppedFrontier`, `TestWALLSNOrderV3_DescriptorFloorIsAlreadyConsumed`, `TestWALIOV3_ValidatedFrontierIntervals`, `TestWALIOV3_ConcurrentAppendsHaveUniqueCursors` | Physical LSN-strict prefix is a contract constraint; r16 model correspondence is pending | STUB | +| `INV-WAL-V3-RECORD-001` | An impl-3 record codec uses the fixed 62-byte prefix and 70-byte overhead, CRC32C and an explicit EntrySize. It refuses unknown types/flags, a zero nonce, invalid per-type geometry, overflowing count/LSN/cursor or LBA spans, nonzero padding, bad CRC/footer and truncation before allocating a payload. Codec success alone is not nonce/cursor/lap replay admission. | M1 v3 record framing | `core/storage/wal_entry_v3.go` `payloadSizeV3`, `encodeWALEntryV3`, `decodeWALEntryV3` | `TestWALEntryV3_CanonicalBarrierBytes`, `TestWALEntryV3_TypeFootprints`, `TestWALEntryV3_RefusesInvalidEncode`, `TestWALEntryV3_RefusesMalformedWire`, `FuzzWALEntryV3_DecodeNeverPanics` | `WALRecovery` abstract record validity; physical byte rules are code-test obligations | STUB | +| `INV-WAL-V3-LSN-ORDER-001` | A v3 writer accepts only a first LSN above its highest consumed LSN; a batch consumes its whole validated range. Equal/lower requests return ErrWALLSNOrder before any pwrite or cursor change. Constructor coverage and a recovered kept frontier count as consumed; a fenced-away suffix does not. | M1 v3 append | `core/storage/wal_io_v3.go` `append`, `newWALWriterV3`, `restoreScanV3` | `TestWALLSNOrderV3_RefusesDuplicateAndLower`, `TestWALLSNOrderV3_BatchConsumesFullRange`, `TestWALLSNOrderV3_RestoreUsesKeptNotDroppedFrontier`, `TestWALLSNOrderV3_DescriptorFloorIsAlreadyConsumed`, `TestWALIOV3_ValidatedFrontierIntervals`, `TestWALIOV3_ConcurrentAppendsHaveUniqueCursors` | Physical LSN-strict prefix is a contract constraint; r16 model correspondence is pending | STUB | | `INV-WAL-V3-RECLAIM-001` | A mapped v3 checkpoint releases only complete validated record ends covered by the checkpoint and outside the retention window; an installing BASE retains its install suffix. Physical recovery rebuilds the volatile boundary index only from the trusted kept scan, without restoring a disconnect cursor. Tail/head/map/checkpoint/W publish together, followed by metadata-only rollover; both slot tails still pin reuse. Failure grants no reuse and retains exact dirty retry identity. Checkpoint publication excludes writer admission through both-slot rollover and dirty-reference retirement. Idle, unchanged-checkpoint and admission settle pending rollover; catch-up revalidates tail/checkpoint before delivering its buffered scan. | M1 checkpoint / existing two-slot retirement | `wal_io_v3.go` `reclaimThroughV3`, `rememberReclaimScanV3`; `walstore_map_checkpoint_v3.go` `publishCheckpointV3`; `descriptor_v3.go` `rolloverIfPinned` | `TestWALStoreV3CheckpointReclaimsAcrossRingLaps`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention`, `TestWALStoreV3ReclaimRebuildsIndexAfterPhysicalRecovery`, `TestWALStoreV3ReclaimAfterInstallingPhysicalReopen`, `TestWALStoreV3ReclaimSecondSlotFailureKeepsOldPin`, `TestWALStoreV3ReclaimRetiresReferencesBeforeReuse`, `TestWALStoreV3ReclaimRolloverProgressWithoutNewCheckpoint`, tagged `TestCatchUpV3AfterCheckpointRingReuse`, `TestCatchUpV3ScanOverlappingCheckpointReuseIsRecycled` | Existing dual-slot retirement and nonce/cursor contract; concrete index/recovery/caller wiring is a code-test obligation | STUB | -| `INV-WAL-V3-OWNER-001` | v3 read/write open, offline readonly open and migrate-v3 acquire the same exclusive nonblocking OS file lock before reading slots or changing bytes. Contention refuses with volume locked; descriptor close releases it, allowing retry. | M1 open admission / offline migration precondition | `core/storage/volume_lock*.go`; `walstore_v3.go`; `walstore_readonly_v3.go`; `cmd/sw-block/migrate.go` | `TestMigrateV3RefusesAnOpenV3Volume`, `TestMigrateV3ExcludesOpenUntilCommitFinishes` (tag `swblock_format_v3_test`), `TestWALStoreV3OwnerExcludesOpenAndReadOnly` | OS mutual exclusion is a caller obligation, outside the abstract crash model; existing open states unchanged | STUB | +| `INV-WAL-V3-OWNER-001` | v3 read/write open, offline readonly open and migrate-v3 acquire the same exclusive nonblocking OS file lock before reading slots or changing bytes. Contention refuses with volume locked; descriptor close releases it, allowing retry. | M1 open admission / offline migration precondition | `core/storage/volume_lock*.go`; `walstore_v3.go`; `walstore_readonly_v3.go`; `cmd/sw-block/migrate.go` | `TestMigrateV3RefusesAnOpenV3Volume`, `TestMigrateV3ExcludesOpenUntilCommitFinishes` (tag `swblock_format_v3_test`), `TestWALStoreV3CreatorKeepsOwnershipThroughPublication`, `TestWALStoreV3OwnerExcludesOpenAndReadOnly` | OS mutual exclusion is a caller obligation, outside the abstract crash model; existing open states unchanged | STUB | | `INV-WAL-V3-CATCHUP-001` | A dark v3 catch-up source refuses while installing, including an empty at-head request. Requests covered by an installed BASE require rebuild (typed WALRecycled); damage in retained WAL remains an integrity failure. Before emitting any entries the scan revalidates recovery generation, nonce, BASE state/ID and install epoch, so begin/complete/retire ABA cannot publish a superseded prefix. | M1 BASE lifecycle / M3 CatchingUp (dark callers) | `core/storage/walstore_recovery.go` `ScanLBAs`, `scanLBAsV3`, `v3CatchUpEntries` | `TestCatchUpV3InstallingAtHeadRefuses`, `TestCatchUpV3CompletedBASEUsesRebuild`, `TestCatchUpV3InstallRetireABARefusesOldScan`, `TestCatchUpV3CorruptFirstRecordFails`, `TestCatchUpV3CorruptMiddleRecordFails`, `TestCatchUpV3CompletedBASESuffix` (tag `swblock_format_v3_test`, actual catch-up sender) | Existing BASE and catch-up transitions unchanged; this physical scan/source-lifetime obligation is covered by deterministic caller tests | STUB | | `INV-WAL-V3-BINDING-001` | The dark v3 writer stamps the selected nonce and absolute cursor, fits each append/padding inside the dual-slot reuse floor, and refuses later I/O after a pwrite failure. A dark scanner checks nonce and exact expected cursor before using Length/count, checks the full record again, skips only geometric end slack, and stops at the first untrusted record without payload resynchronization. It returns a typed scan result, never ACK or serving permission. | M1 Recovering (dark muscles only) | `core/storage/wal_io_v3.go` `append`, `scanWALV3`, `walSnapshotV3` | `TestWALIOV3_RealWriterReopenScan`, `TestWALIOV3_WrapPaddingAndSlack`, `TestWALIOV3_StopsAtBindingBeforeEmbeddedRecord`, `TestWALIOV3_EmbeddedRecordInPayloadIsNotScanned`, `TestWALIOV3_InstalledScanBeginsAtMaxTail`, `TestWALIOV3_FloorAndPwriteFailureRefuse` | Record/lap admission is abstracted in composed WALFormatR5; physical framing/wrap boundaries remain code-test obligations | STUB | -| `INV-WAL-V3-MAP-PUBLISH-001` | After a dark publisher binds a validated map, every publication carries a matching immutable tuple with merged checkpoint <= C <= merged W. A prepared replacement needs a higher generation, non-regressing coverage and the same sidecar/open proof domain with unchanged epoch/mutation token. Stale candidates write no slot; W-only rollover carries the current root; unknown slot outcomes pin dependencies. | M1 (dark map publication only; checkpoint/capture caller wiring pending) | `core/storage/chunk_map_publication_v3.go`; `core/storage/descriptor_v3.go` `publishLockedWithMapV3` | `TestWALStoreV3_SeedNeverUsesLegacyDescriptorWriter`, `TestDurableProviderV3_InvalidHEADFrontierRefusesBeforeClaim`, `TestDurableProviderV3_HEADRestorePreservesRemoteImageAndNextLSN`, `TestDurableProviderV3_HEADRestoreAfterLostClaimResponse`, `TestDurableProviderV3_MappedCheckpointCaptureAndReopen`, `TestDurableProviderV3_MissingMapRefusesBeforeBackend`, `TestDurableProviderV3_DefaultSelectorStillCreatesLegacy` (tag `swblock_format_v3_test`), `TestChunkLayerV3_MapOnlyCaptureNeedsNoLegacyBitmap`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyFreshZeroHEADPreservesLocalWrites`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation`, `TestChunkLayerV3_MapStatusConcurrentClose`, `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_MaxLSNSelectsAfterReopenWithCleanLegacyBitmap`, `TestChunkLayerV3_ChangedCaptureTokenKeepsUNKNOWN`, `TestChunkLayerV3_UnsettledCaptureNeverClearsUNKNOWN`, `TestChunkLayerV3_RefusesMapGeometryBeforeRemote`, `TestWALStoreV3_AutomaticMapCheckpoint`, `TestWALStoreV3_PreparedCheckpointRefusesChangedProof`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestWALStoreV3_UncertainMapCheckpointPinsDependencies`, `TestWALStoreV3_AutomaticCheckpointMetadataOrderAndRetry`, `TestWALStoreV3_AutomaticMapRecoverRebuildsCoverage`, `TestWALStoreV3_OpenRequiresBothMapGenerations`, `TestWALStoreV3_MappedCreateOpenOwnsMap`, `TestMapPublicationV3_BindValidatesBothSlotDependencies`, `TestMapPublicationV3_HeldPublicationsBothOrders`, `TestMapPublicationV3_IsolatedMergedCoverageAndWPositive`, `TestMapPublicationV3_ProofEpochAndMutationRefusal`, `TestMapPublicationV3_UncertainFinalResponsePinsCandidate`, `TestMapPublicationV3_CoverageWAndNoUnpreparedRoot`, `TestMapPublicationV3_ProofChangedDuringPersistenceRefuses`; `TestWALStoreV3_RealRecoverInvalidatesMapProofAtStartAndEnd`, `TestWALStoreV3_FailedRecoverInvalidatesMapProofAtBothBoundaries` | WALFormatR5 map coverage / volatile proof epoch; physical caller wiring remains a code obligation | STUB | +| `INV-WAL-V3-MAP-PUBLISH-001` | After a dark publisher binds a validated map, every publication carries a matching immutable tuple with merged checkpoint <= C <= merged W. A prepared replacement needs a higher generation, non-regressing coverage and the same sidecar/open proof domain with unchanged epoch/mutation token. Stale candidates write no slot; W-only rollover carries the current root; unknown slot outcomes pin dependencies. | M1 (dark map publication only; checkpoint/capture caller wiring pending) | `core/storage/chunk_map_publication_v3.go`; `core/storage/descriptor_v3.go` `publishLockedWithMapV3` | `TestWALStoreV3_SeedNeverUsesLegacyDescriptorWriter`, `TestDurableProviderV3_InvalidHEADFrontierRefusesBeforeClaim`, `TestDurableProviderV3_HEADRestorePreservesRemoteImageAndNextLSN`, `TestDurableProviderV3_HEADRestoreAfterLostClaimResponse`, `TestDurableProviderV3_MappedCheckpointCaptureAndReopen`, `TestDurableProviderV3_MissingMapRefusesBeforeBackend`, `TestDurableProviderV3_DefaultSelectorCreatesV3` (tag `swblock_format_v3_test`), `TestChunkLayerV3_MapOnlyCaptureNeedsNoLegacyBitmap`, `TestChunkLayerV3_IgnoresProvidedLegacyBitmap`, `TestChunkLayerV3_MapOnlyFreshZeroHEADPreservesLocalWrites`, `TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation`, `TestChunkLayerV3_MapStatusConcurrentClose`, `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, `TestChunkLayerV3_MaxLSNSelectsAfterReopenWithCleanLegacyBitmap`, `TestChunkLayerV3_ChangedCaptureTokenKeepsUNKNOWN`, `TestChunkLayerV3_UnsettledCaptureNeverClearsUNKNOWN`, `TestChunkLayerV3_RefusesMapGeometryBeforeRemote`, `TestWALStoreV3_AutomaticMapCheckpoint`, `TestWALStoreV3_PreparedCheckpointRefusesChangedProof`, `TestWALStoreV3_AutomaticMapPersistenceFailureLatchesStore`, `TestWALStoreV3_UncertainMapCheckpointPinsDependencies`, `TestWALStoreV3_AutomaticCheckpointMetadataOrderAndRetry`, `TestWALStoreV3_AutomaticMapRecoverRebuildsCoverage`, `TestWALStoreV3_OpenRequiresBothMapGenerations`, `TestWALStoreV3_MappedCreateOpenOwnsMap`, `TestMapPublicationV3_BindValidatesBothSlotDependencies`, `TestMapPublicationV3_HeldPublicationsBothOrders`, `TestMapPublicationV3_IsolatedMergedCoverageAndWPositive`, `TestMapPublicationV3_ProofEpochAndMutationRefusal`, `TestMapPublicationV3_UncertainFinalResponsePinsCandidate`, `TestMapPublicationV3_CoverageWAndNoUnpreparedRoot`, `TestMapPublicationV3_ProofChangedDuringPersistenceRefuses`; `TestWALStoreV3_RealRecoverInvalidatesMapProofAtStartAndEnd`, `TestWALStoreV3_FailedRecoverInvalidatesMapProofAtBothBoundaries` | WALFormatR5 map coverage / volatile proof epoch; physical caller wiring remains a code obligation | STUB | | `INV-WAL-V3-FLUSH-LIFETIME-001` | A dark v3 flusher binds its dirty snapshot and extent materialization to the original even Recover generation. A cycle spanning Recover/reset publishes no checkpoint/map and retires no reused dirty entry. | M1 Recovering / checkpoint publication | `core/storage/flusher.go`; `walstore_map_checkpoint_v3.go`; `walstore_v3.go` `flushLifetimeValidV3` | `TestWALStoreV3_FlushMaterializationBoundToRecoveryLifetime` | Existing recovery/map proof lifetime; implementation correspondence | STUB | | `INV-WAL-V3-MAP-BYTES-001` | A dark v3 map candidate names immutable, owned, identity- and geometry-checked pages and root. Domain-separated body digests, reserved/unused bytes, exact page counts, file bounds and non-aliasing intervals all validate before entries escape. Persistence orders pages/fsync, root/fsync, directory fsync; a persistence-transaction error yields no candidate and latches subsequent I/O; preflight and Stat errors do not latch. Append-only retention preserves both slots and pending candidates. | M1 (dark map preparation only) | `core/storage/chunk_lsn_map_v3.go` `Prepare`, `readChunkLSNMapV3` | `TestChunkLSNMapV3_CanonicalVectors`, `TestChunkLSNMapV3_PersistReloadAndReuse`, `TestChunkLSNMapV3_CorruptionAndBounds`, `TestChunkLSNMapV3_FailureDoesNotPublishOrReuse`, `TestChunkLSNMapV3_OrderOwnedOpenAndClippedPage`, `TestChunkLSNMapV3_RejectsRehashedMalformedRecords`, `TestChunkLSNMapV3_EntryBoundBeforeRootIO`, `TestChunkLSNMapV3_WholePageHashIsNotBodyDigest`, `TestChunkLSNMapV3_PreflightErrorDoesNotLatch` | WALFormatR5 abstract map dependency; physical encoding/digest/order are code obligations | STUB | | `INV-WAL-V3-PUBLISH-001` | Every v3 descriptor change goes through one publisher. It writes the fallback slot with slotGen+1 under `descMu`. It takes `WALStore.mu` only to snapshot and releases it before slot I/O, and fsync is the leaf. It rebases onto the authoritative descriptor: W and the checkpoint are max-merged, and identity, geometry and nonce changes are refused, as are tail regression, a map root change without a higher generation and any BASE edge outside DESIGN 8.5 (installed -> installing is refused). A failed slot write (full or partial) or fsync publishes nothing. It latches the store fault inside the fsync leaf, before `fileSyncMu` is released, so a queued store Sync cannot acknowledge through it, keeps the uncertain candidate pinned and refuses every later publication, rollover and reuse until a reopen reads the slots back. A fault latched mid-flight is refused at the success boundary. A counter above 2^64-2 is refused with `ErrCounterExhausted` before any write. When the fallback slot pins reuse, a metadata-only rollover advances the floor, and no floor is ever computed across nonces. | M1 Serving (v3 descriptor publication) | `core/storage/descriptor_v3.go` `publish`, `mergeDescriptorV3`, `baseTransitionAllowedV3`, `rolloverIfPinned`, `reuseFloor` | `TestDescriptorV3PublishAlternatesSlotsAndReopenSelectsNewest`, `TestDescriptorV3MergeIsMonotonicAndRefusesForbiddenChanges`, `TestDescriptorV3ConcurrentPublishersNeverRegress`, `TestDescriptorV3LockOrderRecorder`, `TestDescriptorV3FsyncFailureIsStickyAndPublishesNothing`, `TestDescriptorV3FaultLatchedDuringPublicationRefusesAtSuccessBoundary`, `TestDescriptorV3FullRingRolloverAdvancesTheFloorWithoutAnyChange`, `TestDescriptorV3RolloverFsyncFailureKeepsTheFloorPinned`, `TestDescriptorV3MixedNoncesNeverYieldAReuseFloor`, `TestDescriptorV3BaseTransitionTable`, `TestDescriptorV3SlotWriteErrorLatchesAndPinsTheCandidate`, `TestDescriptorV3PublicationCounterExhaustion`, `TestDescriptorV3QueuedStoreSyncCannotAckAfterSlotWriteError` (`core/storage/descriptor_v3_test.go`) | — | STUB | diff --git a/seaweed-block/docs/spec/README.md b/seaweed-block/docs/spec/README.md index f099fe7432..4794a7a27d 100644 --- a/seaweed-block/docs/spec/README.md +++ b/seaweed-block/docs/spec/README.md @@ -216,3 +216,9 @@ All 12 specs parse and pass SANY's semantic check with `tla2tools.jar` v1.7.4 `CutPipeline`, `ReplicationFailover`, `RetentionGCMulti`, `RetentionGCTiming`, `SmartWALRecovery`, `WALRecovery`, `WALReplica`, `WorkspaceTakeover`. The state counts above come from earlier TLC runs of these specs; comment-only edits were made since. + +## Format-v3 activation correspondence + +The public selector now reaches the mapped impl3 paths in `walstore_v3.go`, `descriptor_v3.go`, `wal_io_v3.go` and `walstore_map_checkpoint_v3.go`. This is activation of the previously reviewed format contract, not a new abstract transition. Its canonical signed design is r17.4 (`e2a5304ef8fdc29f7e109883b8664a5c93d37a559e7b93e1d24964cb09cb7824`), with the composed external S3/BASE/install/map TLC receipts referenced by that design. The in-repository `WALRecovery.tla` remains an abstraction and is not a proof of every physical nonce/cursor/map/dual-slot rule. Pending external bounded runs remain pending; activation tests and source correspondence do not turn them into exhaustive proof. + +Native Go controls and the temporary frozen-v2 fixture disposition are listed in [the activation inventory](../design/format-v3-legacy-test-inventory.md). Old-codec tests are preserved, and both default and tagged migration/caller suites are validation gates. No model equation is changed by the selector wiring; a new counterexample still requires an amendment before affected integration.