mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
Merge pull request #212 from seaweedfs/refactor/remove-production-c11-bitmap
Remove production C11 file bitmap persistence
This commit is contained in:
commit
cc5cf09af0
15 files changed
+110
-69
No files matched your search
@@ -411,8 +411,7 @@ func TestFork_ThenFreshHostReadsSnapshotImage(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r, _ := NewChunkRemote(f, b, path.Join(catBase, vol))
|
||||
cfg := storage.ChunkLayerConfig{ChunkBlocks: chunkBlocks, Epoch: epoch, Holder: vol, FreshFromHead: fresh,
|
||||
Bitmap: storage.NewFileChunkBitmapStore(p + ".chunkbitmap")}
|
||||
cfg := storage.ChunkLayerConfig{ChunkBlocks: chunkBlocks, Epoch: epoch, Holder: vol, FreshFromHead: fresh}
|
||||
if fresh {
|
||||
// This low-level fixture bypasses the provider: perform the same
|
||||
// takeover and durable frontier seed before attaching its layer.
|
||||
@@ -586,8 +585,7 @@ func TestDetach_ProductionSerializedHead(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r, _ := NewChunkRemote(f, b, catBase+"/v1")
|
||||
l, err := storage.AttachChunkLayer(s, r, storage.ChunkLayerConfig{ChunkBlocks: 8, Epoch: 3, Holder: "host-a",
|
||||
Bitmap: storage.NewFileChunkBitmapStore(p + ".chunkbitmap")})
|
||||
l, err := storage.AttachChunkLayer(s, r, storage.ChunkLayerConfig{ChunkBlocks: 8, Epoch: 3, Holder: "host-a"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -228,7 +228,6 @@ func TestIntegration_ChunkLayerCaptureThenFreshHost(t *testing.T) {
|
||||
}
|
||||
l, err := storage.AttachChunkLayer(s, c.remote(t, root), storage.ChunkLayerConfig{
|
||||
ChunkBlocks: chunkBlocks, Epoch: 1, Holder: name, FreshFromHead: fresh,
|
||||
Bitmap: storage.NewFileChunkBitmapStore(p + ".chunkbitmap"),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -262,7 +262,6 @@ func TestChunkRemote_ChunkLayerCaptureThenFreshHost(t *testing.T) {
|
||||
r := newTestRemote(t, f, b)
|
||||
l, err := storage.AttachChunkLayer(s, r, storage.ChunkLayerConfig{
|
||||
ChunkBlocks: chunkBlocks, Epoch: 1, Holder: name, FreshFromHead: fresh,
|
||||
Bitmap: storage.NewFileChunkBitmapStore(p + ".chunkbitmap"),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -77,8 +77,7 @@ func TestGC_StalledCutRemainsReadableAfterTwoMarks(t *testing.T) {
|
||||
if _, e = s.Recover(); e != nil {
|
||||
t.Fatal(e)
|
||||
}
|
||||
layer, e := storage.AttachChunkLayer(s, held, storage.ChunkLayerConfig{ChunkBlocks: 8, Epoch: 1, Holder: "h1", Bitmap: storage.NewFileChunkBitmapStore(p + ".bitmap"),
|
||||
FreshFromHead: true}) // a new, empty store: its dirty set is known (empty)
|
||||
layer, e := storage.AttachChunkLayer(s, held, storage.ChunkLayerConfig{ChunkBlocks: 8, Epoch: 1, Holder: "h1", FreshFromHead: true}) // a new, empty store: its dirty set is known (empty)
|
||||
if e != nil {
|
||||
t.Fatal(e)
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ func TestManifestPerf_64DirtyChunks(t *testing.T) {
|
||||
if _, err = s.Recover(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
l, err := storage.AttachChunkLayer(s, r, storage.ChunkLayerConfig{ChunkBlocks: 1024, Epoch: 1, Holder: "h1", FreshFromHead: true, UploadConcurrency: parallel, Bitmap: storage.NewFileChunkBitmapStore(filepath.Join(dir, "bitmap"))})
|
||||
l, err := storage.AttachChunkLayer(s, r, storage.ChunkLayerConfig{ChunkBlocks: 1024, Epoch: 1, Holder: "h1", FreshFromHead: true, UploadConcurrency: parallel})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ func TestManifest_CapturePublishesSegmentRoot(t *testing.T) {
|
||||
if _, err = s.Recover(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
l, err := storage.AttachChunkLayer(s, r, storage.ChunkLayerConfig{ChunkBlocks: 8, Epoch: 1, Holder: "h1", FreshFromHead: true, Bitmap: storage.NewFileChunkBitmapStore(p + ".bitmap")})
|
||||
l, err := storage.AttachChunkLayer(s, r, storage.ChunkLayerConfig{ChunkBlocks: 8, Epoch: 1, Holder: "h1", FreshFromHead: true})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -289,7 +289,7 @@ func TestManifest_NoopFlatUpgradeUsesOneNormalGeneration(t *testing.T) {
|
||||
if _, err = s.Recover(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
l, err := storage.AttachChunkLayer(s, r, storage.ChunkLayerConfig{ChunkBlocks: 8, Epoch: 1, Holder: "h1", FreshFromHead: true, Bitmap: storage.NewFileChunkBitmapStore(p + ".bitmap")})
|
||||
l, err := storage.AttachChunkLayer(s, r, storage.ChunkLayerConfig{ChunkBlocks: 8, Epoch: 1, Holder: "h1", FreshFromHead: true})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -313,7 +313,6 @@ func (p *DurableProvider) newChunkLayer(ctx context.Context, volumeID string, h
|
||||
Holder: holder,
|
||||
FreshFromHead: h.fresh,
|
||||
ReadMissTimeout: p.cfg.ChunkReadMissTimeout,
|
||||
Bitmap: storage.NewFileChunkBitmapStore(h.path + ".chunkbitmap"),
|
||||
BarrierBound: p.cfg.ChunkDirtyThreshold,
|
||||
UploadConcurrency: p.cfg.ChunkUploadConcurrency,
|
||||
CaptureAllowed: func() error {
|
||||
@@ -328,10 +327,6 @@ func (p *DurableProvider) newChunkLayer(ctx context.Context, volumeID string, h
|
||||
return nil
|
||||
},
|
||||
}
|
||||
if p.testWALStoreFactory != nil {
|
||||
// Dark mapped caller controls must not rely on the legacy C11 sidecar.
|
||||
cfg.Bitmap = nil
|
||||
}
|
||||
if !h.fresh {
|
||||
// An existing local volume is this holder's image only while HEAD is
|
||||
// still this holder's publication. Another holder's HEAD means the
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"go/ast"
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// The retained C11 file codec is historical fixture evidence, not a store
|
||||
// option. Inspect uses as well as declarations (including function aliases).
|
||||
func TestProductionExcludesC11FileStore(t *testing.T) {
|
||||
for _, dir := range []string{".", filepath.Join("..", "frontend", "durable")} {
|
||||
files, err := os.ReadDir(dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
inspected := 0
|
||||
for _, entry := range files {
|
||||
name := entry.Name()
|
||||
if entry.IsDir() || !strings.HasSuffix(name, ".go") || strings.HasSuffix(name, "_test.go") {
|
||||
continue
|
||||
}
|
||||
inspected++
|
||||
file := filepath.Join(dir, name)
|
||||
f, err := parser.ParseFile(token.NewFileSet(), file, nil, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ast.Inspect(f, func(n ast.Node) bool {
|
||||
id, ok := n.(*ast.Ident)
|
||||
if ok && (strings.Contains(id.Name, "FileChunkBitmapStore") || id.Name == "legacyC11FileStore" || id.Name == "newLegacyC11FileStore") {
|
||||
t.Errorf("production source %s retains C11 file store %s", file, id.Name)
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
if inspected == 0 {
|
||||
t.Fatalf("no production source inspected in %s", dir)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFileChunkBitmapStore_RoundTripAndReopen(t *testing.T) {
|
||||
func TestLegacyC11FileCodec_RoundTripAndReopen(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "vol.chunkbitmap")
|
||||
b := NewFileChunkBitmapStore(path)
|
||||
b := newLegacyC11FileStore(path)
|
||||
if _, _, ok, err := b.Load(); ok || err != nil {
|
||||
t.Fatalf("empty store: ok %v err %v", ok, err)
|
||||
}
|
||||
@@ -30,7 +30,7 @@ func TestFileChunkBitmapStore_RoundTripAndReopen(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// A new instance reads exactly the durable state.
|
||||
b2 := NewFileChunkBitmapStore(path)
|
||||
b2 := newLegacyC11FileStore(path)
|
||||
hdr, dirty, ok, err = b2.Load()
|
||||
if !ok || err != nil || hdr != want || !reflect.DeepEqual(dirty, []uint64{7}) {
|
||||
t.Fatalf("reopened: ok %v err %v hdr %+v dirty %v", ok, err, hdr, dirty)
|
||||
@@ -41,9 +41,9 @@ func TestFileChunkBitmapStore_RoundTripAndReopen(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFileChunkBitmapStore_CorruptStateIsLost(t *testing.T) {
|
||||
func TestLegacyC11FileCodec_CorruptStateIsLost(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "vol.chunkbitmap")
|
||||
b := NewFileChunkBitmapStore(path)
|
||||
b := newLegacyC11FileStore(path)
|
||||
if err := b.Save([]uint64{1}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -55,17 +55,17 @@ func TestFileChunkBitmapStore_CorruptStateIsLost(t *testing.T) {
|
||||
if err := os.WriteFile(path, raw, 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, _, ok, err := NewFileChunkBitmapStore(path).Load(); ok || err != nil {
|
||||
if _, _, ok, err := newLegacyC11FileStore(path).Load(); ok || err != nil {
|
||||
t.Fatalf("corrupt state: ok %v err %v, want ok=false (hash-compare fallback) and no error", ok, err)
|
||||
}
|
||||
}
|
||||
|
||||
// The layer with the production file bitmap and the in-memory remote:
|
||||
// after a crash the first cut is incremental and exact.
|
||||
func TestChunkLayer_FileBitmapIncrementalAfterRestart(t *testing.T) {
|
||||
// The mapped layer and the in-memory remote: after a crash the owned map
|
||||
// makes the first cut incremental and exact, without a C11 file sidecar.
|
||||
func TestChunkLayer_OwnedMapIncrementalAfterRestart(t *testing.T) {
|
||||
s, path, crash := crashableStore(t)
|
||||
remote := NewMemChunkRemote()
|
||||
cfg := chunkLayerConfig{ChunkBlocks: ctChunkBlocks, Epoch: 1, Holder: "h", Bitmap: NewFileChunkBitmapStore(path + ".chunkbitmap")}
|
||||
cfg := chunkLayerConfig{ChunkBlocks: ctChunkBlocks, Epoch: 1, Holder: "h"}
|
||||
layer := mustAttach(t, s, remote, cfg)
|
||||
w := newWriteLog()
|
||||
w.write(t, s, 1, 0x01) // chunk 0
|
||||
@@ -73,15 +73,15 @@ func TestChunkLayer_FileBitmapIncrementalAfterRestart(t *testing.T) {
|
||||
if _, err := layer.Capture(context.Background()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
w.write(t, s, 24, 0x24) // chunk 6, flushed: only the bitmap remembers it
|
||||
w.write(t, s, 24, 0x24) // chunk 6, flushed: the owned map remembers it
|
||||
mustSyncFlush(t, s)
|
||||
w.write(t, s, 28, 0x28) // chunk 7, WAL only
|
||||
if _, err := s.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assertNoC11Sidecars(t, path)
|
||||
crash()
|
||||
s2, _ := reopen(t, path)
|
||||
cfg.Bitmap = NewFileChunkBitmapStore(path + ".chunkbitmap") // a fresh instance reads the file
|
||||
layer2 := mustAttach(t, s2, remote, cfg)
|
||||
before := remote.Puts()
|
||||
h, err := layer2.Capture(context.Background())
|
||||
@@ -104,4 +104,14 @@ func TestChunkLayer_FileBitmapIncrementalAfterRestart(t *testing.T) {
|
||||
copy(img[int(idx)*ctChunkBytes:], b)
|
||||
}
|
||||
assertImage(t, "HEAD image after restart", img, w.imageAt(h))
|
||||
assertNoC11Sidecars(t, path)
|
||||
}
|
||||
|
||||
func assertNoC11Sidecars(t *testing.T, path string) {
|
||||
t.Helper()
|
||||
for _, suffix := range []string{".chunkbitmap", ".chunkbitmap.deltas"} {
|
||||
if _, err := os.Stat(path + suffix); !os.IsNotExist(err) {
|
||||
t.Fatalf("C11 sidecar %s: got %v, want absent", suffix, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,12 @@ import (
|
||||
)
|
||||
|
||||
func TestClaimChunkHeadClearsProductionDetachProof(t *testing.T) {
|
||||
s, path := newChunkTestStore(t)
|
||||
s, _ := newChunkTestStore(t)
|
||||
if _, err := s.Recover(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
remote := NewMemChunkRemote()
|
||||
layer, err := AttachChunkLayer(s, remote, ChunkLayerConfig{ChunkBlocks: 4, Epoch: 1, Holder: "old", Bitmap: NewFileChunkBitmapStore(path + ".bitmap")})
|
||||
layer, err := AttachChunkLayer(s, remote, ChunkLayerConfig{ChunkBlocks: 4, Epoch: 1, Holder: "old"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
+14
-13
@@ -1,6 +1,7 @@
|
||||
package storage
|
||||
|
||||
// FileChunkBitmapStore is the production chunkBitmapStore: one state file
|
||||
// legacyC11FileStore preserves the retired C11 file codec for historical tests.
|
||||
// It is compiled only into this package's tests: one state file
|
||||
// (header + dirty-since-HEAD chunks, with a SHA-256 over its body) replaced
|
||||
// atomically on every change, plus an append-only delta log with one JSON
|
||||
// record per closed HEAD period. Every method is durable on return.
|
||||
@@ -17,7 +18,7 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
type FileChunkBitmapStore struct {
|
||||
type legacyC11FileStore struct {
|
||||
path string
|
||||
|
||||
mu sync.Mutex
|
||||
@@ -27,10 +28,10 @@ type FileChunkBitmapStore struct {
|
||||
dirty []uint64
|
||||
}
|
||||
|
||||
// NewFileChunkBitmapStore returns a store at path (the delta log is
|
||||
// newLegacyC11FileStore returns a store at path (the delta log is
|
||||
// path + ".deltas").
|
||||
func NewFileChunkBitmapStore(path string) *FileChunkBitmapStore {
|
||||
return &FileChunkBitmapStore{path: path}
|
||||
func newLegacyC11FileStore(path string) *legacyC11FileStore {
|
||||
return &legacyC11FileStore{path: path}
|
||||
}
|
||||
|
||||
type chunkBitmapFile struct {
|
||||
@@ -44,7 +45,7 @@ type chunkBitmapEnvelope struct {
|
||||
SHA256 string `json:"sha256"`
|
||||
}
|
||||
|
||||
func (b *FileChunkBitmapStore) loadLocked() error {
|
||||
func (b *legacyC11FileStore) loadLocked() error {
|
||||
if b.loaded {
|
||||
return nil
|
||||
}
|
||||
@@ -72,7 +73,7 @@ func (b *FileChunkBitmapStore) loadLocked() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *FileChunkBitmapStore) writeLocked(hdr chunkBitmapHeader, dirty []uint64) error {
|
||||
func (b *legacyC11FileStore) writeLocked(hdr chunkBitmapHeader, dirty []uint64) error {
|
||||
body, err := json.Marshal(chunkBitmapFile{Version: 1, Header: hdr, Dirty: dirty})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -93,7 +94,7 @@ func (b *FileChunkBitmapStore) writeLocked(hdr chunkBitmapHeader, dirty []uint64
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *FileChunkBitmapStore) Load() (chunkBitmapHeader, []uint64, bool, error) {
|
||||
func (b *legacyC11FileStore) Load() (chunkBitmapHeader, []uint64, bool, error) {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
if err := b.loadLocked(); err != nil {
|
||||
@@ -105,7 +106,7 @@ func (b *FileChunkBitmapStore) Load() (chunkBitmapHeader, []uint64, bool, error)
|
||||
return b.hdr, append([]uint64(nil), b.dirty...), true, nil
|
||||
}
|
||||
|
||||
func (b *FileChunkBitmapStore) Save(dirty []uint64) error {
|
||||
func (b *legacyC11FileStore) Save(dirty []uint64) error {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
if err := b.loadLocked(); err != nil {
|
||||
@@ -114,7 +115,7 @@ func (b *FileChunkBitmapStore) Save(dirty []uint64) error {
|
||||
return b.writeLocked(b.hdr, dirty)
|
||||
}
|
||||
|
||||
func (b *FileChunkBitmapStore) WriteHeader(hdr chunkBitmapHeader) error {
|
||||
func (b *legacyC11FileStore) WriteHeader(hdr chunkBitmapHeader) error {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
if err := b.loadLocked(); err != nil {
|
||||
@@ -123,7 +124,7 @@ func (b *FileChunkBitmapStore) WriteHeader(hdr chunkBitmapHeader) error {
|
||||
return b.writeLocked(hdr, b.dirty)
|
||||
}
|
||||
|
||||
func (b *FileChunkBitmapStore) Reset(hdr chunkBitmapHeader, stillDirty []uint64, delta chunkDelta) error {
|
||||
func (b *legacyC11FileStore) Reset(hdr chunkBitmapHeader, stillDirty []uint64, delta chunkDelta) error {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
if err := b.loadLocked(); err != nil {
|
||||
@@ -152,7 +153,7 @@ func (b *FileChunkBitmapStore) Reset(hdr chunkBitmapHeader, stillDirty []uint64,
|
||||
}
|
||||
|
||||
// Deltas returns the archived delta records, oldest first.
|
||||
func (b *FileChunkBitmapStore) Deltas() ([]chunkDelta, error) {
|
||||
func (b *legacyC11FileStore) Deltas() ([]chunkDelta, error) {
|
||||
raw, err := os.ReadFile(b.path + ".deltas")
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return nil, nil
|
||||
@@ -174,4 +175,4 @@ func (b *FileChunkBitmapStore) Deltas() ([]chunkDelta, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
var _ chunkBitmapStore = (*FileChunkBitmapStore)(nil)
|
||||
var _ chunkBitmapStore = (*legacyC11FileStore)(nil)
|
||||
@@ -40,11 +40,13 @@ func TestLegacyFixtureIsolation(t *testing.T) {
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, "go", "list", "-deps", "-json", "./core/storage")
|
||||
cmd.Dir = filepath.Join("..", "..")
|
||||
cmd.WaitDelay = 2 * time.Second
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
t.Fatalf("default production transitive import graph: %v", err)
|
||||
}
|
||||
dec := json.NewDecoder(strings.NewReader(string(out)))
|
||||
foundStorage := false
|
||||
for dec.More() {
|
||||
var p struct {
|
||||
ImportPath string
|
||||
@@ -57,13 +59,17 @@ func TestLegacyFixtureIsolation(t *testing.T) {
|
||||
t.Errorf("unexpected frozen import %s", p.ImportPath)
|
||||
}
|
||||
if p.ImportPath == "github.com/seaweedfs/seaweed-block/core/storage" {
|
||||
foundStorage = true
|
||||
for _, n := range p.GoFiles {
|
||||
if n == "format_v3_test_support.go" {
|
||||
if n == "format_v3_test_support.go" || n == "legacy_c11_file_fixture_test.go" {
|
||||
t.Fatal("test constructors entered default production import closure")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if !foundStorage {
|
||||
t.Fatal("production dependency graph did not contain core/storage")
|
||||
}
|
||||
}
|
||||
|
||||
func legacyConstructorReferences(f *ast.File, forbidden map[string]bool) []string {
|
||||
|
||||
@@ -359,20 +359,6 @@
|
||||
],
|
||||
"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",
|
||||
@@ -580,31 +566,31 @@
|
||||
},
|
||||
{
|
||||
"file": "core/storage/chunk_bitmap_file_test.go",
|
||||
"test": "TestFileChunkBitmapStore_CorruptStateIsLost",
|
||||
"test": "TestLegacyC11FileCodec_CorruptStateIsLost",
|
||||
"legacy_roots": [
|
||||
"NewFileChunkBitmapStore"
|
||||
"newLegacyC11FileStore"
|
||||
],
|
||||
"reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery",
|
||||
"reason": "retired C11 file codec retained only in legacy_c11_file_fixture_test.go; no production constructor or file store",
|
||||
"v3_controls": [
|
||||
"TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint",
|
||||
"TestChunkLayerV3_IgnoresProvidedLegacyBitmap",
|
||||
"TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation"
|
||||
],
|
||||
"todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b"
|
||||
"todo": "row 14a: review historical fixture disposition; row 14b removed the production file store without deleting these codec assertions"
|
||||
},
|
||||
{
|
||||
"file": "core/storage/chunk_bitmap_file_test.go",
|
||||
"test": "TestFileChunkBitmapStore_RoundTripAndReopen",
|
||||
"test": "TestLegacyC11FileCodec_RoundTripAndReopen",
|
||||
"legacy_roots": [
|
||||
"NewFileChunkBitmapStore"
|
||||
"newLegacyC11FileStore"
|
||||
],
|
||||
"reason": "legacy C11 bitmap persistence/reconciliation or pre-v3 permissive frontier/record surgery",
|
||||
"reason": "retired C11 file codec retained only in legacy_c11_file_fixture_test.go; no production constructor or file store",
|
||||
"v3_controls": [
|
||||
"TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint",
|
||||
"TestChunkLayerV3_IgnoresProvidedLegacyBitmap",
|
||||
"TestChunkLayerV3_MapOnlyRefusesLegacyBASEHeaderMutation"
|
||||
],
|
||||
"todo": "row 14a: move or retire explicitly only after replacement/migration review; no deletion in 12b"
|
||||
"todo": "row 14a: review historical fixture disposition; row 14b removed the production file store without deleting these codec assertions"
|
||||
},
|
||||
{
|
||||
"file": "core/storage/walstore_checkpoint_safety_test.go",
|
||||
|
||||
@@ -8,6 +8,8 @@ These mappings are coverage references, not a claim that different disk formats
|
||||
|
||||
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.
|
||||
|
||||
Row 14b removes the production C11 file store and all callers of its constructor. Its roundtrip/corruption codec assertions remain in `TestLegacyC11FileCodec_*`, backed only by `legacy_c11_file_fixture_test.go`. `TestChunkLayer_OwnedMapIncrementalAfterRestart` is now an explicit native-v3 checkpoint/reopen/incremental-capture control with no C11 sidecar; it is no longer a legacy inventory entry. The temporary fake-bitmap legacy engine controls below remain subject to row 14a.
|
||||
|
||||
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 |
|
||||
@@ -38,7 +40,6 @@ TODO(row 14a): relocate or retire every listed legacy control explicitly; preser
|
||||
| `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` |
|
||||
@@ -53,8 +54,8 @@ TODO(row 14a): relocate or retire every listed legacy control explicitly; preser
|
||||
| `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/chunk_bitmap_file_test.go::TestLegacyC11FileCodec_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::TestLegacyC11FileCodec_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` |
|
||||
|
||||
@@ -63,6 +63,8 @@ stateDiagram-v2
|
||||
| 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` | — |
|
||||
|
||||
Production C11 file persistence was removed in row 14b: the durable provider no longer constructs a bitmap sidecar, and the historical file codec exists only in `legacy_c11_file_fixture_test.go`. `INV-CUT-BITMAP-001` retains its explicit legacy engine tests until row 14a; it does not certify the v3 disk format. Native checkpoint/capture coverage is `TestWALStoreV3_AutomaticMapCheckpoint`, `TestChunkLayerV3_CaptureUsesOwnedMapAfterCheckpoint`, and `TestChunkLayer_OwnedMapIncrementalAfterRestart` (checkpointed and WAL-only changes survive reopen without a C11 sidecar). The production map publication/coverage rules remain `INV-WAL-V3-MAP-PUBLISH-001`; no descriptor transition, format or durability boundary changes here. The receiver session bitmap (`INV-RECV-BITMAP-CORE`) is separate and unchanged.
|
||||
|
||||
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.
|
||||
|
||||
Reference in new issue
Block a user