mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 11:07:31 +01:00
storage: the v1.1 format follows the assigned level, not a build tag
A chunk layer decides its format once at attach from its config's FormatLevel and the store's marker: level 1 upgrades a v1.0 store; level 0 keeps it on v1.0; a store already on v1.1 at level 0 is served over a version-1 HEAD (reported as format_level_behind_volume) and refused over a version-0 HEAD (format_level_behind_store). The layout remote's HEAD format follows its layer (SetHeadFormatV11) and reports the version it read (HeadV11). Every production attach is level 0 until the assignment carries the master's level, so a release build keeps writing v1.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0022052d54
commit
9a4078e17a
18 files changed
+345
-85
No files matched your search
@@ -11,9 +11,9 @@ import (
|
||||
// withManifestSizes turns the v1.1 manifest sizes on for one test.
|
||||
func withManifestSizes(t *testing.T, on bool) {
|
||||
t.Helper()
|
||||
prev := manifestSizesV11
|
||||
manifestSizesV11 = func() bool { return on }
|
||||
t.Cleanup(func() { manifestSizesV11 = prev })
|
||||
prev := manifestSizesTestOverride
|
||||
manifestSizesTestOverride = func() bool { return on }
|
||||
t.Cleanup(func() { manifestSizesTestOverride = prev })
|
||||
}
|
||||
|
||||
// currentSize recomputes the size HEAD's current manifest has, from all of
|
||||
@@ -152,3 +152,38 @@ func TestACommitByChangeKeepsAnUnchangedTouchedSegmentInTheSize(t *testing.T) {
|
||||
t.Fatalf("size %v, want %d (the sum of the manifest's objects)", h.CurrentBytes, want)
|
||||
}
|
||||
}
|
||||
|
||||
// The remote's HEAD format follows the attaching layer (SetHeadFormatV11),
|
||||
// not the build: a remote left at v1.0 commits version 0, and once its layer
|
||||
// sets v1.1 the next commit writes version 1 and HeadV11 reports it.
|
||||
func TestLayoutRemoteHeadFormatFollowsItsLayer(t *testing.T) {
|
||||
ctx, _, r, h1 := threeShardVolume(t) // no override: the remote's own format, v1.0 by default
|
||||
h, _, err := r.st.ReadHead(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if h.Version != 0 || r.HeadV11() {
|
||||
t.Fatalf("a remote never set to v1.1 committed version %d (HeadV11 %v)", h.Version, r.HeadV11())
|
||||
}
|
||||
r.SetHeadFormatV11(true)
|
||||
ref := putChunk(t, ctx, r, layout.ShardSize+9, "second")
|
||||
changes := map[uint64]*storage.ChunkRef{layout.ShardSize + 9: &ref}
|
||||
exp := storage.ChunkHeadVersion{Gen: h1.Gen, Epoch: 1}
|
||||
next := storage.ChunkHead{Epoch: 1, RemoteLSN: 2}
|
||||
if err := r.CheckCommitDelta(ctx, exp, next, changes); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := r.CASHeadDelta(ctx, exp, next, changes); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
h, _, err = r.st.ReadHead(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if h.Version != layout.HeadVersion1 {
|
||||
t.Fatalf("after the layer set v1.1: HEAD version %d, want 1", h.Version)
|
||||
}
|
||||
if _, err := r.GetHeadRoot(ctx); err != nil || !r.HeadV11() {
|
||||
t.Fatalf("HeadV11 after reading a version-1 HEAD: %v %v", r.HeadV11(), err)
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,10 @@ type LayoutRemote struct {
|
||||
vol VolumeRef
|
||||
me layout.HolderID
|
||||
|
||||
// headV11: commits write a v1.1 HEAD (SetHeadFormatV11, at attach);
|
||||
// readV11: the HEAD last read is version 1 (HeadV11).
|
||||
headV11, readV11 atomic.Bool
|
||||
|
||||
mu sync.Mutex
|
||||
session string
|
||||
// visible is the HEAD generation the engine sees: it moves with this
|
||||
@@ -398,6 +402,7 @@ func (l *LayoutRemote) headIdentityLocked(ctx context.Context) (layout.Head, sto
|
||||
if h.Epoch == l.me.Epoch && h.Holder == l.me.Holder && h.ClaimID != l.me.ClaimID {
|
||||
return layout.Head{}, storage.ChunkHead{}, fmt.Errorf("%w: HEAD is held by %s at epoch %d (claim %q)", storage.ErrChunkLayerFenced, h.Holder, h.Epoch, h.ClaimID)
|
||||
}
|
||||
l.readV11.Store(h.Version >= layout.HeadVersion1)
|
||||
out := storage.ChunkHead{Gen: l.visible, Epoch: h.Epoch, Holder: h.Holder, RemoteLSN: h.Position, Chunks: map[uint64]storage.ChunkRef{}, State: "active"}
|
||||
if h.State == layout.StateDetached {
|
||||
out.State = "detached"
|
||||
@@ -565,7 +570,7 @@ func (l *LayoutRemote) prepareCommitLocked(ctx context.Context, expected storage
|
||||
return layout.Head{}, layout.CommitRequest{}, false, err
|
||||
}
|
||||
}
|
||||
req := layout.CommitRequest{Session: l.session, Prev: prev, Next: nextM, Position: next.RemoteLSN, State: layout.StateLive, V11: manifestSizesV11()}
|
||||
req := layout.CommitRequest{Session: l.session, Prev: prev, Next: nextM, Position: next.RemoteLSN, State: layout.StateLive, V11: l.manifestSizesV11()}
|
||||
if delta {
|
||||
plan, err := layout.PlanCommit(l.vol.Name, layout.CommitRequest{Delta: &d}, true)
|
||||
if err != nil {
|
||||
@@ -575,7 +580,7 @@ func (l *LayoutRemote) prepareCommitLocked(ctx context.Context, expected storage
|
||||
return layout.Head{}, layout.CommitRequest{}, false, err
|
||||
}
|
||||
req.Delta, req.Plan = &d, &plan
|
||||
if manifestSizesV11() {
|
||||
if l.manifestSizesV11() {
|
||||
if req.ManifestBytes, err = deltaManifestSize(h.CurrentBytes, d, plan); err != nil {
|
||||
return layout.Head{}, layout.CommitRequest{}, false, err
|
||||
}
|
||||
@@ -585,7 +590,7 @@ func (l *LayoutRemote) prepareCommitLocked(ctx context.Context, expected storage
|
||||
if err != nil {
|
||||
return layout.Head{}, layout.CommitRequest{}, false, err
|
||||
}
|
||||
if manifestSizesV11() {
|
||||
if l.manifestSizesV11() {
|
||||
req.ManifestBytes = &size
|
||||
}
|
||||
}
|
||||
@@ -946,9 +951,26 @@ func (l *LayoutRemote) writeRootLocked(ctx context.Context, next map[uint64]layo
|
||||
return size, layoutRemoteErr(err)
|
||||
}
|
||||
|
||||
// SetHeadFormatV11 is storage.ChunkHeadFormatter: the attaching layer's
|
||||
// format decides whether this remote's commits write a v1.1 HEAD (version 1,
|
||||
// the manifest sizes). Set once at attach, before any commit.
|
||||
func (l *LayoutRemote) SetHeadFormatV11(v11 bool) { l.headV11.Store(v11) }
|
||||
|
||||
// HeadV11 is storage.ChunkHeadFormatter: whether the HEAD this remote last
|
||||
// read is version 1 (a v1.1 HEAD).
|
||||
func (l *LayoutRemote) HeadV11() bool { return l.readV11.Load() }
|
||||
|
||||
// manifestSizesV11 says whether commits write the manifest sizes (v1.1 HEAD
|
||||
// fields): the build's draft v1.1 format. Tests of this package set it.
|
||||
var manifestSizesV11 = storage.ChunkV11Format
|
||||
// fields): the attaching layer's format. manifestSizesTestOverride, set by
|
||||
// this package's tests only, replaces it.
|
||||
func (l *LayoutRemote) manifestSizesV11() bool {
|
||||
if f := manifestSizesTestOverride; f != nil {
|
||||
return f()
|
||||
}
|
||||
return l.headV11.Load()
|
||||
}
|
||||
|
||||
var manifestSizesTestOverride func() bool
|
||||
|
||||
// manifestSize is the size of a root and the segments given.
|
||||
func manifestSize(root layout.Root, segs map[layout.SegName][]byte) (uint64, error) {
|
||||
@@ -1115,8 +1137,8 @@ func (l *LayoutRemote) CommitPendingSnapshot(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req := layout.CommitRequest{Session: l.session, Prev: m, Next: m, Position: h.Position, State: layout.StateLive, Snapshot: p.name, Meta: p.meta, V11: manifestSizesV11()}
|
||||
if manifestSizesV11() {
|
||||
req := layout.CommitRequest{Session: l.session, Prev: m, Next: m, Position: h.Position, State: layout.StateLive, Snapshot: p.name, Meta: p.meta, V11: l.manifestSizesV11()}
|
||||
if l.manifestSizesV11() {
|
||||
req.ManifestBytes = &size
|
||||
}
|
||||
got, err := layout.RunCommit(ctx, l.st, l.st, l.vol.Name, l.me, req, layout.CauseSnapshotUnchanged)
|
||||
|
||||
@@ -111,6 +111,7 @@ func TestProviderWrappedRemoteKeepsTheLayoutRemotesOptionalInterfaces(t *testing
|
||||
b, ok := r.(storage.ChunkHeadStepBounder)
|
||||
return ok && b.BoundsHeadStep()
|
||||
},
|
||||
"ChunkHeadFormatter": func(r storage.ChunkRemote) bool { _, ok := r.(storage.ChunkHeadFormatter); return ok },
|
||||
"ChunkKeyer": func(r storage.ChunkRemote) bool { _, ok := r.(storage.ChunkKeyer); return ok },
|
||||
"ChunkPutRounds": func(r storage.ChunkRemote) bool { _, ok := r.(storage.ChunkPutRounds); return ok },
|
||||
"ChunkSegmentReader": func(r storage.ChunkRemote) bool { _, ok := r.(storage.ChunkSegmentReader); return ok },
|
||||
|
||||
@@ -544,6 +544,7 @@ func (p *DurableProvider) newChunkLayer(ctx context.Context, volumeID string, h
|
||||
Epoch: lin.epoch,
|
||||
Holder: holder,
|
||||
FreshFromHead: h.fresh,
|
||||
FormatLevel: 0, // the assignment's level once it carries one; absent = 0
|
||||
CleanStop: cleanStop,
|
||||
CreatedThisStart: h.fresh && h.createdThisStart,
|
||||
ReadMissTimeout: p.cfg.ChunkReadMissTimeout,
|
||||
@@ -622,6 +623,22 @@ type layoutRemoteCapabilities interface {
|
||||
// closeBoundRemote ends every remote call when the provider closes, so a
|
||||
// shutdown never waits on the remote for an attach or a cut. While an
|
||||
// attach runs, its calls also end with the attach caller's context.
|
||||
// SetHeadFormatV11 forwards the attaching layer's HEAD format to the
|
||||
// remote it wraps (storage.ChunkHeadFormatter), so the wrapper never hides
|
||||
// it: a remote that does not take it writes as it always did.
|
||||
func (r *closeBoundRemote) SetHeadFormatV11(v11 bool) {
|
||||
if f, ok := r.ChunkRemote.(storage.ChunkHeadFormatter); ok {
|
||||
f.SetHeadFormatV11(v11)
|
||||
}
|
||||
}
|
||||
|
||||
// HeadV11 forwards the wrapped remote's answer; a remote that cannot tell
|
||||
// reports a v1.0 HEAD (the attach then refuses rather than guess).
|
||||
func (r *closeBoundRemote) HeadV11() bool {
|
||||
f, ok := r.ChunkRemote.(storage.ChunkHeadFormatter)
|
||||
return ok && f.HeadV11()
|
||||
}
|
||||
|
||||
type closeBoundRemote struct {
|
||||
storage.ChunkRemote
|
||||
done context.Context
|
||||
|
||||
@@ -60,7 +60,7 @@ func TestAttachReportsItsVolumeSizedLocalWork(t *testing.T) {
|
||||
// than the store's, which the absent marking and the presence save
|
||||
// then count per volume chunk.
|
||||
want := uint64(4 * n)
|
||||
if chunkV11Format {
|
||||
if chunkFormatLevelTestFloor >= 1 {
|
||||
vol := uint64(s.NumBlocks())
|
||||
want = n + 3*min(n, vol) + 2*vol
|
||||
}
|
||||
@@ -107,7 +107,7 @@ func TestAttachReportsItsVolumeSizedLocalWork(t *testing.T) {
|
||||
// is not saved again); on the v1.1 format, the HEAD copy and the
|
||||
// record's pages judged at the open.
|
||||
want := uint64(2 * n)
|
||||
if chunkV11Format {
|
||||
if chunkFormatLevelTestFloor >= 1 {
|
||||
want = n + uint64(s.NumBlocks())
|
||||
}
|
||||
if c.total != want {
|
||||
|
||||
@@ -67,9 +67,12 @@ func (f *fakeChunkRemote) releaseDeferredCAS() int {
|
||||
// logs every call in order, and injects faults on request. Every field is
|
||||
// guarded by mu.
|
||||
type fakeChunkRemote struct {
|
||||
mu sync.Mutex
|
||||
objs map[string][]byte
|
||||
head chunkHead // Gen 0 = no HEAD yet
|
||||
mu sync.Mutex
|
||||
// writeV11: the attach set the v1.1 HEAD format (SetHeadFormatV11); headV11:
|
||||
// a CAS made under it installed a version-1 HEAD (one way, as a real HEAD).
|
||||
writeV11, headV11 bool
|
||||
objs map[string][]byte
|
||||
head chunkHead // Gen 0 = no HEAD yet
|
||||
|
||||
// ops: "put:<key>", "get:<key>", "gethead", "delete:<key>", and one of
|
||||
// "cas:ok", "cas:pre" (precondition), "cas:unknown", "cas:lost", "cas:err".
|
||||
@@ -312,6 +315,9 @@ func (f *fakeChunkRemote) installLocked(next chunkHead) {
|
||||
installed.Gen = f.head.Gen + 1
|
||||
f.head = installed
|
||||
f.heads = append(f.heads, copyChunkHead(installed))
|
||||
if f.writeV11 {
|
||||
f.headV11 = true
|
||||
}
|
||||
}
|
||||
|
||||
func (f *fakeChunkRemote) Delete(ctx context.Context, key string) error {
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func (f *fakeChunkRemote) SetHeadFormatV11(v11 bool) {
|
||||
f.mu.Lock()
|
||||
f.writeV11 = v11
|
||||
f.mu.Unlock()
|
||||
}
|
||||
|
||||
func (f *fakeChunkRemote) HeadV11() bool {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
return f.headV11
|
||||
}
|
||||
|
||||
func levelAttach(t *testing.T, s *WALStore, f *fakeChunkRemote, level uint8) (*chunkLayerImpl, error) {
|
||||
t.Helper()
|
||||
cfg := ctConfig(2)
|
||||
cfg.Bitmap = nil
|
||||
cfg.FormatLevel = level
|
||||
l, err := attachChunkLayer(s, f, cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
li := l.(*chunkLayerImpl)
|
||||
waitReconciledForTest(t, li)
|
||||
t.Cleanup(func() { _ = li.Close() })
|
||||
return li, nil
|
||||
}
|
||||
|
||||
func storeMarked(t *testing.T, s *WALStore) bool {
|
||||
t.Helper()
|
||||
m, _ := s.ChunkStateMarker()
|
||||
return m
|
||||
}
|
||||
|
||||
// At format level 0 (the assignment's, absent = 0) a v1.0 store stays on the
|
||||
// v1.0 format across attach, cut and restart: no upgrade (unmarked), the
|
||||
// layer runs v1.0 and every HEAD it writes is version 0. At level 1 the same
|
||||
// store upgrades at attach and the cut writes a version-1 HEAD.
|
||||
func TestAttachFormatFollowsTheAssignedLevel(t *testing.T) {
|
||||
v10Only(t) // the attach's own level, never the package's test mode
|
||||
withoutUpgradePass(t)
|
||||
t.Run("level 0", func(t *testing.T) {
|
||||
s, path, f := uncleanUpgradeStore(t)
|
||||
l, err := levelAttach(t, s, f, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if l.v11 || storeMarked(t, s) {
|
||||
t.Fatalf("level 0 attach: v1.1 %v, store marked %v; want the v1.0 format", l.v11, storeMarked(t, s))
|
||||
}
|
||||
if _, err := s.Write(0, makeBlock(ctBlockSize, 0xA0)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := l.Cut(ctTimeout(t)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if f.HeadV11() {
|
||||
t.Fatal("a level-0 cut wrote a version-1 HEAD")
|
||||
}
|
||||
crashStore(t, s)
|
||||
r := reopenRecovered(t, path)
|
||||
r.HoldExtentDrainUntilChunkLayer()
|
||||
l2, err := levelAttach(t, r, f, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if l2.v11 || storeMarked(t, r) || f.HeadV11() {
|
||||
t.Fatalf("after the restart at level 0: v1.1 %v, marked %v, HEAD v1 %v; want v1.0 throughout", l2.v11, storeMarked(t, r), f.HeadV11())
|
||||
}
|
||||
})
|
||||
t.Run("level 1", func(t *testing.T) {
|
||||
s, _, f := uncleanUpgradeStore(t)
|
||||
l, err := levelAttach(t, s, f, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !l.v11 || !storeMarked(t, s) {
|
||||
t.Fatalf("level 1 attach: v1.1 %v, store marked %v; want the store upgraded", l.v11, storeMarked(t, s))
|
||||
}
|
||||
if _, err := s.Write(0, makeBlock(ctBlockSize, 0xA1)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := l.Cut(ctTimeout(t)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !f.HeadV11() {
|
||||
t.Fatal("a level-1 cut wrote a version-0 HEAD")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// The level only decides whether an attach may raise a volume's format. At
|
||||
// level 0 a store already on v1.1 is served as v1.1 when its HEAD is version
|
||||
// 1 too (reported as format_level_behind_volume), and refused typed
|
||||
// (format_level_behind_store) when HEAD is still version 0, which serving
|
||||
// would have to raise; a level-1 attach then opens it normally.
|
||||
func TestAttachAtLevelZeroOfAnUpgradedStore(t *testing.T) {
|
||||
v10Only(t)
|
||||
withoutUpgradePass(t)
|
||||
t.Run("HEAD version 1: served, reported", func(t *testing.T) {
|
||||
s, path, f := uncleanUpgradeStore(t)
|
||||
l, err := levelAttach(t, s, f, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := s.Write(0, makeBlock(ctBlockSize, 0xB1)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := l.Cut(ctTimeout(t)); err != nil || !f.HeadV11() {
|
||||
t.Fatalf("setup: level-1 cut %v, HEAD v1 %v", err, f.HeadV11())
|
||||
}
|
||||
crashStore(t, s)
|
||||
r := reopenRecovered(t, path)
|
||||
r.HoldExtentDrainUntilChunkLayer()
|
||||
l2, err := levelAttach(t, r, f, 0)
|
||||
if err != nil {
|
||||
t.Fatalf("level 0 over a v1.1 store and HEAD: %v, want served", err)
|
||||
}
|
||||
if !l2.v11 || !l2.Stats().FormatLevelBehindVolume {
|
||||
t.Fatalf("level 0 over v1.1: v1.1 %v, behind reported %v; want served as v1.1 and reported", l2.v11, l2.Stats().FormatLevelBehindVolume)
|
||||
}
|
||||
})
|
||||
t.Run("HEAD version 0: refused, then a level-1 attach opens it", func(t *testing.T) {
|
||||
s, path, f := uncleanUpgradeStore(t)
|
||||
l, err := levelAttach(t, s, f, 1) // upgrades the store, no cut: HEAD stays version 0
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !storeMarked(t, s) || f.HeadV11() {
|
||||
t.Fatalf("setup: marked %v, HEAD v1 %v; want a marked store under a version-0 HEAD", storeMarked(t, s), f.HeadV11())
|
||||
}
|
||||
_ = l
|
||||
crashStore(t, s)
|
||||
r := reopenRecovered(t, path)
|
||||
r.HoldExtentDrainUntilChunkLayer()
|
||||
if _, err := levelAttach(t, r, f, 0); !errors.Is(err, ErrFormatLevelBehindStore) {
|
||||
t.Fatalf("level 0 over a v1.1 store with a version-0 HEAD: %v, want format_level_behind_store", err)
|
||||
}
|
||||
if f.HeadV11() {
|
||||
t.Fatal("the refused attach wrote a version-1 HEAD")
|
||||
}
|
||||
l3, err := levelAttach(t, r, f, 1)
|
||||
if err != nil || !l3.v11 || l3.Stats().FormatLevelBehindVolume {
|
||||
t.Fatalf("level 1 after the refusal: %v (v1.1 %v); want opened normally", err, l3 != nil && l3.v11)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -91,6 +91,12 @@ func (a *attachProgress) flush() {
|
||||
}
|
||||
|
||||
type chunkLayerImpl struct {
|
||||
// v11: this layer runs the v1.1 format (decided once at attach from its
|
||||
// config's FormatLevel and the store's marker; attachFormatV11).
|
||||
v11 bool
|
||||
// formatBehind: attached at level 0 to a store and HEAD already on v1.1
|
||||
// (a master fault; served as v1.1, reported on status and log).
|
||||
formatBehind bool
|
||||
attachProgress attachProgress // attach only; loadPresence reports through it
|
||||
// capMu serializes pre-copy admission and its recent measurements.
|
||||
precopyFreeze func(uint64, time.Time, chunkCutStats) bool
|
||||
@@ -335,6 +341,13 @@ func attachChunkLayerImpl(s *WALStore, remote chunkRemote, cfg chunkLayerConfig)
|
||||
syncDirFn: syncDir,
|
||||
}
|
||||
l.chunkMut = make([]atomic.Uint64, l.numChunks)
|
||||
storeMarked, _ := s.ChunkStateMarker()
|
||||
var checkFormatHead bool
|
||||
l.v11, checkFormatHead = attachFormat(cfg.FormatLevel, storeMarked)
|
||||
formatter, _ := remote.(ChunkHeadFormatter)
|
||||
if formatter != nil {
|
||||
formatter.SetHeadFormatV11(l.v11)
|
||||
}
|
||||
l.attachProgress = attachProgress{report: cfg.AttachProgress}
|
||||
defer l.attachProgress.flush() // work completed by a failed attempt still counts
|
||||
var nb8 [8]byte
|
||||
@@ -349,6 +362,14 @@ func attachChunkLayerImpl(s *WALStore, remote chunkRemote, cfg chunkLayerConfig)
|
||||
l.cancel()
|
||||
return nil, fmt.Errorf("storage: chunk layer attach: read HEAD: %w", err)
|
||||
}
|
||||
if checkFormatHead {
|
||||
if formatter == nil || !formatter.HeadV11() {
|
||||
l.cancel()
|
||||
return nil, ErrFormatLevelBehindStore
|
||||
}
|
||||
l.formatBehind = true
|
||||
log.Printf("level=WARN storage: chunk layer attach: format_level_behind_volume: assigned format level 0, the store and HEAD are on v1.1; served as v1.1")
|
||||
}
|
||||
l.remoteLSN = head.RemoteLSN
|
||||
// A HEAD that already belongs to a newer epoch or a competing holder is
|
||||
// never used as this holder's publication guard.
|
||||
@@ -381,7 +402,7 @@ func attachChunkLayerImpl(s *WALStore, remote chunkRemote, cfg chunkLayerConfig)
|
||||
if cfg.CreatedThisStart {
|
||||
l.freshKnownZero = l.freshKnownZeroCandidates()
|
||||
}
|
||||
} else if marked, _ := s.ChunkStateMarker(); chunkV11Format && marked {
|
||||
} else if storeMarked {
|
||||
// The v1.1 record and the store's bits hold presence: a leftover
|
||||
// .chunkpresence is never read (the open removes it).
|
||||
} else if err := l.loadPresence(); err != nil {
|
||||
@@ -389,9 +410,8 @@ func attachChunkLayerImpl(s *WALStore, remote chunkRemote, cfg chunkLayerConfig)
|
||||
return nil, err
|
||||
}
|
||||
upgradedNow := false
|
||||
if chunkV11Format {
|
||||
marked, _ := s.ChunkStateMarker()
|
||||
upgradedNow = !marked
|
||||
if l.v11 {
|
||||
upgradedNow = !storeMarked
|
||||
l.shadow, err = l.openChunkRecordV11()
|
||||
} else {
|
||||
l.shadow, err = newChunkRecordShadow(l)
|
||||
@@ -483,7 +503,7 @@ func (l *chunkLayerImpl) headRef(idx uint64) (chunkRef, bool) {
|
||||
// read whole: settlement, adoption, a fence) and the layer keeps h's
|
||||
// identity, no flat map (V4-B PR 4). Caller holds stMu or owns the layer.
|
||||
func (l *chunkLayerImpl) setHeadLocked(h chunkHead) {
|
||||
if !chunkV11Format {
|
||||
if !l.v11 {
|
||||
l.head, l.refs = h, nil
|
||||
return
|
||||
}
|
||||
@@ -503,7 +523,7 @@ func (l *chunkLayerImpl) setHeadLocked(h chunkHead) {
|
||||
// It returns HEAD as installed (identity only on the v1.1 format).
|
||||
func (l *chunkLayerImpl) readAttachHead(remote chunkRemote) (chunkHead, error) {
|
||||
sr, segmented := remote.(ChunkSegmentReader)
|
||||
if !chunkV11Format || !segmented {
|
||||
if !l.v11 || !segmented {
|
||||
head, err := remote.GetHead(l.ctx)
|
||||
if err != nil {
|
||||
return chunkHead{}, err
|
||||
@@ -1613,7 +1633,7 @@ func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (res ch
|
||||
inPlace := byChange && fromBase // cur is the cut's base: its candidates only
|
||||
finishCapturedCut(cur, h, nil, nil, inPlace) // nothing new: no CAS
|
||||
persistCapturedMap(capturedVersions)
|
||||
return chunkCutResult{H: h, Head: resultHead(cur), Noop: true, FullHash: all}, nil
|
||||
return chunkCutResult{H: h, Head: l.resultHead(cur), Noop: true, FullHash: all}, nil
|
||||
}
|
||||
expected := chunkHeadVersion{Gen: baseHead.Gen, Epoch: baseHead.Epoch}
|
||||
// On the v1.1 format the commit goes by change: one owned change set,
|
||||
@@ -1661,7 +1681,7 @@ func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (res ch
|
||||
finishCapturedCut(next, h, changed, newKeys, changes != nil)
|
||||
l.shadowCommit(captured, capturedVersions)
|
||||
persistCapturedMap(capturedVersions)
|
||||
return l.cutDone(chunkCutResult{H: h, Head: resultHead(next), FullHash: all}, detach), nil
|
||||
return l.cutDone(chunkCutResult{H: h, Head: l.resultHead(next), FullHash: all}, detach), nil
|
||||
}
|
||||
// Precondition or unknown outcome: resolve by re-reading HEAD, never by
|
||||
// a blind retry.
|
||||
@@ -1705,7 +1725,7 @@ func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (res ch
|
||||
finishCapturedCut(cur, h, changed, newKeys, false) // cur is HEAD as read: whole
|
||||
l.shadowCommit(captured, capturedVersions)
|
||||
persistCapturedMap(capturedVersions)
|
||||
return l.cutDone(chunkCutResult{H: h, Head: resultHead(cur), FullHash: all}, detach), nil
|
||||
return l.cutDone(chunkCutResult{H: h, Head: l.resultHead(cur), FullHash: all}, detach), nil
|
||||
}
|
||||
// HEAD moved past the CAS's base without it: it can never land, and
|
||||
// what it staged was compared against a HEAD that is gone.
|
||||
@@ -1831,10 +1851,10 @@ func (l *chunkLayerImpl) SettleDetach(ctx context.Context) (settled detachSettle
|
||||
l.setHeadLocked(copyHead(cur))
|
||||
l.remoteLSN = cur.RemoteLSN
|
||||
l.shadowCommitCaptured(landed, true)
|
||||
cut.Head = resultHead(cur)
|
||||
cut.Head = l.resultHead(cur)
|
||||
l.detached = &cut
|
||||
r := cut
|
||||
r.Head = resultHead(cur)
|
||||
r.Head = l.resultHead(cur)
|
||||
return detachApplied, r, nil
|
||||
case l.supersededBy(cur):
|
||||
l.fenced = true
|
||||
@@ -2093,7 +2113,7 @@ func cutResultHead(h chunkHead, byChange bool) chunkHead {
|
||||
// resultHead is the HEAD every cut, settlement and detach outcome reports and
|
||||
// keeps: identity only on the v1.1 format, on every path (a whole read's,
|
||||
// a re-proposal's, a no-op's), so no result holds a chunk map; whole before.
|
||||
func resultHead(h chunkHead) chunkHead { return cutResultHead(h, chunkV11Format) }
|
||||
func (l *chunkLayerImpl) resultHead(h chunkHead) chunkHead { return cutResultHead(h, l.v11) }
|
||||
|
||||
// noteSettledFromHeadLocked records the publication from the layer's HEAD,
|
||||
// whole (the ref table's image on the v1.1 format), to next, before next is
|
||||
@@ -2243,7 +2263,7 @@ func (l *chunkLayerImpl) resolvePending(ctx context.Context) (err error) {
|
||||
l.remoteLSN = cur.RemoteLSN
|
||||
l.shadowCommitCaptured(landed, true)
|
||||
if wasDetach {
|
||||
cut.Head = resultHead(cur)
|
||||
cut.Head = l.resultHead(cur)
|
||||
l.detached = &cut
|
||||
return errChunkLayerDetached
|
||||
}
|
||||
@@ -2417,6 +2437,7 @@ func (l *chunkLayerImpl) Stats() chunkLayerStats {
|
||||
out.CurrentCut = ¤t
|
||||
}
|
||||
out.UpgradePass = l.upgradePassStatusLocked()
|
||||
out.FormatLevelBehindVolume = l.formatBehind
|
||||
out.Hydration.WorkerLimit = l.cfg.HydrationWorkers
|
||||
out.Hydration.QueueDepth = l.cfg.HydrationQueueDepth
|
||||
for _, f := range l.hydration {
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestMain(m *testing.M) {
|
||||
// format (the lab build's mode); it selects a format, it turns no check
|
||||
// off.
|
||||
if os.Getenv("CHUNK_RECORD_V11") == "1" {
|
||||
chunkV11Format = true
|
||||
chunkFormatLevelTestFloor = 1
|
||||
}
|
||||
code := m.Run()
|
||||
mu.Lock()
|
||||
|
||||
@@ -9,22 +9,22 @@ import (
|
||||
"github.com/seaweedfs/seaweed-block/core/chunkkernel"
|
||||
)
|
||||
|
||||
// withV11Format turns the draft v1.1 store format on for one test (release
|
||||
// builds keep it off; this package's tests run serially).
|
||||
// withV11Format makes every attach of one test run at format level 1 (the
|
||||
// v1.1 store format; this package's tests run serially).
|
||||
func withV11Format(t *testing.T) {
|
||||
t.Helper()
|
||||
prev := chunkV11Format
|
||||
chunkV11Format = true
|
||||
t.Cleanup(func() { chunkV11Format = prev })
|
||||
prev := chunkFormatLevelTestFloor
|
||||
chunkFormatLevelTestFloor = 1
|
||||
t.Cleanup(func() { chunkFormatLevelTestFloor = prev })
|
||||
}
|
||||
|
||||
// v10Only runs a test on the v1.0 store format (.chunkpresence), whatever
|
||||
// format the run selected: what it asserts is v1.0's.
|
||||
func v10Only(t *testing.T) {
|
||||
t.Helper()
|
||||
prev := chunkV11Format
|
||||
chunkV11Format = false
|
||||
t.Cleanup(func() { chunkV11Format = prev })
|
||||
prev := chunkFormatLevelTestFloor
|
||||
chunkFormatLevelTestFloor = 0
|
||||
t.Cleanup(func() { chunkFormatLevelTestFloor = prev })
|
||||
}
|
||||
|
||||
// v11Store is a mapped store, recovered, with extent draining held: what a
|
||||
|
||||
@@ -322,6 +322,12 @@ type chunkLayerConfig struct {
|
||||
// HEAD (every block absent, read lazily). False means an existing local
|
||||
// volume. Never inferred from the local contents.
|
||||
FreshFromHead bool
|
||||
// FormatLevel is the cluster format level this attach runs at (the
|
||||
// master's, through the assignment): at 0 a v1.0 store stays on the v1.0
|
||||
// format; at 1 the attach upgrades it to v1.1. A store already on v1.1 is
|
||||
// opened as v1.1 at either level, never downgraded. Absent (0) fails
|
||||
// closed: an older master, or none yet, never starts an upgrade.
|
||||
FormatLevel uint8
|
||||
// CleanStop is the clean stop of this root's lineage that the start's
|
||||
// claim was built on (nil: none). The v1.0.x upgrade seeds every whole
|
||||
// local chunk with HEAD's hash only when it holds at the store's synced
|
||||
@@ -526,6 +532,9 @@ type chunkLayerStats struct {
|
||||
LastCutNs int64 // when it completed (wall clock, Unix ns)
|
||||
CutSeq uint64 // successful cuts of this layer so far (in-process); the latest cut's identity
|
||||
UpgradePass UpgradePassStatus // the upgrade compare pass after a v1.0 store's upgrade (v1.1): none, seeded, running, done or failed
|
||||
// FormatLevelBehindVolume: attached at format level 0 to a store and HEAD
|
||||
// already on v1.1 (format_level_behind_volume): served as v1.1.
|
||||
FormatLevelBehindVolume bool
|
||||
// BarrierOverBound counts cuts whose barrier copied more than the
|
||||
// bound after the staging rounds.
|
||||
BarrierOverBound uint64
|
||||
|
||||
@@ -130,7 +130,7 @@ func TestSpaceMeasurementControls(t *testing.T) {
|
||||
long := strings.Repeat("v", 101) // a 100-byte longer owner name
|
||||
longer := heldPerChunk(t, chunks, 1, long)
|
||||
t.Logf("held per chunk with keys 100 B longer: %.0f B (+%.0f)", longer, longer-geo[1])
|
||||
if chunkV11Format {
|
||||
if chunkFormatLevelTestFloor >= 1 {
|
||||
// The ref table derives canonical keys from an interned owner prefix:
|
||||
// a longer owner name costs once, not per chunk.
|
||||
if d := longer - geo[1]; d > 10 || d < -10 {
|
||||
@@ -157,7 +157,7 @@ func TestSpacePerChunkAt1TiBShape(t *testing.T) {
|
||||
oneMap = chunkHead{}
|
||||
per := heldPerChunk(t, chunks, 1, "v1")
|
||||
t.Logf("SPACE at 1 TiB's chunk count (%d chunks, v1.1 format %v, canonical %d-byte keys): %.0f B/chunk held after attach; one flat map with its keys is %.0f B/chunk",
|
||||
chunks, chunkV11Format, len(canonicalKey("v1", "309016fbc5b31531e1e7c44585851c7d", chunks-1, [32]byte{})), per, flat)
|
||||
chunks, chunkFormatLevelTestFloor >= 1, len(canonicalKey("v1", "309016fbc5b31531e1e7c44585851c7d", chunks-1, [32]byte{})), per, flat)
|
||||
if per > 200 {
|
||||
t.Fatalf("SPACE: %.0f B/chunk held, want at most 200", per)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,43 @@
|
||||
package storage
|
||||
|
||||
// chunkV11Format says whether a chunk layer upgrades its store to the draft
|
||||
// v1.1 format at attach and opens it from the chunk record. It is the
|
||||
// build's constant; this package's tests turn it on for the tests that
|
||||
// exercise the format.
|
||||
var chunkV11Format = chunkV11FormatBuild
|
||||
import "errors"
|
||||
|
||||
// ChunkV11Format reports whether this build (or test) runs the draft v1.1
|
||||
// format: what a chunk store's HEAD writer uses to decide whether it may
|
||||
// write v1.1 HEAD fields.
|
||||
func ChunkV11Format() bool { return chunkV11Format }
|
||||
// chunkFormatLevelTestFloor, set by this package's tests only, raises the
|
||||
// format level every attach runs at (withV11Format, and the package's v1.1
|
||||
// mode). Production attaches run at their config's FormatLevel.
|
||||
var chunkFormatLevelTestFloor uint8
|
||||
|
||||
// attachFormat is an attach's format decision from its level and the store's
|
||||
// marker. The level only decides whether the attach may RAISE a volume's
|
||||
// format (FormatGate's Upgrade1, only at level 1); a format never goes down.
|
||||
// At level 0 a store already marked v1.1 runs v1.1, but only over a HEAD
|
||||
// already at version 1 (checkHead: the attach confirms it after reading
|
||||
// HEAD); never max(level, marker).
|
||||
func attachFormat(level uint8, marked bool) (v11, checkHead bool) {
|
||||
if chunkFormatLevelTestFloor > level {
|
||||
level = chunkFormatLevelTestFloor
|
||||
}
|
||||
switch {
|
||||
case level >= 1:
|
||||
return true, false
|
||||
case !marked:
|
||||
return false, false
|
||||
default:
|
||||
return true, true
|
||||
}
|
||||
}
|
||||
|
||||
// ErrFormatLevelBehindStore refuses an attach at level 0 of a store already
|
||||
// upgraded to v1.1 whose HEAD is still version 0: serving it would write a
|
||||
// version-1 HEAD at level 0, or downgrade the store, and both are refused.
|
||||
// An attach at level 1 opens it normally.
|
||||
var ErrFormatLevelBehindStore = errors.New("storage: format_level_behind_store: the store is on the v1.1 format, its HEAD is not, and the assigned format level is 0")
|
||||
|
||||
// ChunkHeadFormatter is a remote whose HEAD format follows the attach: the
|
||||
// layer sets the write format once at attach, before any HEAD write (a layer
|
||||
// on the v1.0 format writes a v1.0 HEAD, one on v1.1 a v1.1 HEAD), and asks
|
||||
// whether the HEAD it read at attach is already version 1.
|
||||
type ChunkHeadFormatter interface {
|
||||
SetHeadFormatV11(v11 bool)
|
||||
HeadV11() bool
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
//go:build swblock_v11_format
|
||||
|
||||
package storage
|
||||
|
||||
// chunkV11FormatBuild is true in a build with the swblock_v11_format tag: the
|
||||
// draft v1.1 store format is exercised on lab volumes. Never a release build
|
||||
// (CI refuses the tag in every image and release build). It is independent of
|
||||
// swblock_lab_bigvol, which lifts only the create cap.
|
||||
const chunkV11FormatBuild = true
|
||||
@@ -1,10 +0,0 @@
|
||||
//go:build !swblock_v11_format
|
||||
|
||||
package storage
|
||||
|
||||
// chunkV11FormatBuild is false in a release build: the v1.1 store format
|
||||
// (chunk record pages, the coverage map and the chunk-state marker) is not
|
||||
// final, so no release binary upgrades a user's store to it; the v1.0 path
|
||||
// (.chunkpresence) stays. One later change declares the format, removes this
|
||||
// guard and fixes the version.
|
||||
const chunkV11FormatBuild = false
|
||||
@@ -1,18 +0,0 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/geometry"
|
||||
"github.com/seaweedfs/seaweed-block/internal/buildinfo"
|
||||
)
|
||||
|
||||
// The draft v1.1 format follows its own tag (swblock_v11_format) alone: the
|
||||
// lab cap tag (swblock_lab_bigvol) does not turn it on, and a build that runs
|
||||
// it names itself in its revision (the image refusal keys on that). CI runs
|
||||
// this with no tag, with each tag alone and with both.
|
||||
func TestV11FormatFollowsItsOwnTagAlone(t *testing.T) {
|
||||
if chunkV11FormatBuild != buildinfo.V11FormatDraft {
|
||||
t.Fatalf("v1.1 format %v, but the build's format tag says %v (cap tag %v)", chunkV11FormatBuild, buildinfo.V11FormatDraft, geometry.LabBigVolume)
|
||||
}
|
||||
}
|
||||
@@ -649,6 +649,7 @@ The "Machine / transition" column refers to Part A. Notes under a table record w
|
||||
| `INV-CHUNK-RECORD-RUNTIME-001` | While serving: state only via the kernel, a hash only with its evidence; a page dirties only on a state or hash change and is written by its count or age (an evict's at once), in snapshot order, after the WAL is synced through the position it shows; G <= min(applied, dirty-from, WAL synced). | M3 Serving (chunk record runtime) | `core/storage/chunk_record_runtime.go` `chunkRecordRuntime.Apply`, `Due`, `WriteDue`, `WriteThrough`, `Flush`, `writeSegmentLocked` (`syncThrough`), `writeHeaderLocked` (`durable`) | `TestRecordRuntimeAppliesTheKernel`, `TestRecordRuntimeEvictWritesThePageFirst`, `TestRecordRuntimeSchedulePerPage`, `TestRecordRuntimeFlushIsLoadedBack`, `TestRecordRuntimeWriteThrough`, `TestRecordRuntimeAnUnchangedStateWritesNothing`, `TestRecordRuntimeHeaderMovesUnderWrites`, `TestRecordRuntimeEvictDuringAFlushLandsLast`, `TestRecordRuntimePageWritesFollowChangesNotSize`, `TestRecordRuntimePageWritersPublishInOrder`, `TestRecordRuntimeHashEvidence`, `TestRecordRuntimeCopiesItsInputs`, `TestRecordRuntimeAPageChangedAtOpenHoldsG` (`core/storage/chunk_record_runtime_test.go`); the WAL bound: `TestV11NoPageClaimsMoreThanTheDurableWAL`, `TestV11APageNeverShowsAWriteTheWALCanLose` (`core/storage/chunk_record_v11_review_test.go`, `chunk_record_v11_hold_test.go`) | chunk-kernel/2; ChunkPages rule 1 (pages before the header) and rule 3 (an evict writes its page first) (the per-chunk state models are not in this repository) | STUB |
|
||||
| `INV-CHUNK-RECORD-SHADOW-001` | While serving, the chunk record follows the engine's events via the kernel; an event bound to a captured version is skipped, never refused, after a write; at each barrier every chunk the engine captures is a record candidate. It decides nothing; on v1.0 it writes no page. | M3 Serving (chunk record shadow) | `core/storage/chunk_record_shadow.go` `newChunkRecordShadow`, `chunkRecordShadow.check`; `core/storage/chunk_layer.go` `noteMutation`, `fillOnce`, `EvictChunk`, `recoveredLocked`, `BeforeCheckpointAdvance`, `shadowCommit`, `shadowCommitCaptured` (also from `resolvePending`, `SettleDetach`); `core/storage/chunk_cut_payload.go` `markEqualNow`; `core/storage/chunk_record_runtime.go` `ApplyIf` | `TestShadowWriteCoverageFollowsTheStoreBitmap`, `TestShadowFillRacedByAWriteEndsUnknown`, `TestShadowCutOfAPartialChunkKeepsItPartial`, `TestShadowAttachKeepsACheckpointedWriteACandidate`, `TestShadowWriteRacingHashAndCommitIsSkippedNotRefused`, `TestShadowEvictEdges`, `TestShadowRecordWritesNoPage`, `TestShadowCheckerIsExactAndCatchesAMissingWrite`, `TestShadowRecoverChangesOnlyTheRecoveredChunks`, `TestShadowBaseInstallCompletingChangesEveryChunk`, `TestShadowDelayedSettlementCommitsTheCapturedChunks`, `TestShadowProductionCheckDoesNotScanTheRecord`, `TestShadowScratchExemptionIsBoundToItsCapturedVersion` (`core/storage/chunk_record_shadow_test.go`); every test of the package runs with the shadow strict, misses and extra record candidates both (`TestMain`, `core/storage/chunk_record_shadow_main_test.go`) | chunk-kernel/2 (the per-chunk state models are not in this repository) | ACTIVE |
|
||||
| `INV-CHUNK-RECORD-V11-001` | On the draft v1.1 format a layer upgrades its store once at attach and opens from its record; a fill's page claims no local block before one durable mark (partial fills and later writes too); an evict clears the store's bits only after its absent page is durable, retries too. | M1 Opened, M3 Serving (draft v1.1 format) | `core/storage/chunk_record_open.go` `openChunkRecordV11`, `loadChunkRecordV11`, `markFills`; `core/storage/chunk_record_upgrade.go` `upgradeChunkRecordWith`; `core/storage/chunk_record_runtime.go` `holdFills`, `PersistSegmentOf`; `core/storage/chunk_record_shadow.go` `evict`; `core/storage/chunk_layer.go` `EvictChunk`, `Close` | `TestV11AttachUpgradesTheStoreOnce`, `TestV11ReopenJudgesAWriteAfterThePageAsChanged`, `TestV11CleanStopWritesOnlyTheDirtyPages`, `TestV11UpgradeRecoversFromACrashAtEachStep`, `TestV11DamagedPageIsRebuiltFromTheStoreBits`, `TestV11FillsAreMarkedInOneBatchBeforeTheirPagesClaimThem`, `TestV11EvictSurvivesARestart` (`core/storage/chunk_record_v11_test.go`); `TestV11CloseDuringTheUpgradeRefusesTheAttach`, `TestV11EvictWithoutItsAbsentPageClearsNothing`, `TestV11ParkedFillBatchCannotOverwriteAnEvict`, `TestV11MalformedLeftoverPresenceDoesNotRefuseTheAttach`, `TestV11FinalPageFailureIsTheCloseResult` (`core/storage/chunk_record_v11_review_test.go`); `TestV11PartialFillWaitsForTheDurableMark`, `TestV11WriteAfterAHeldFillKeepsTheHold`, `TestV11EvictRetryStillWritesItsAbsentPage` (`core/storage/chunk_record_v11_hold_test.go`); `TestV11AbsentChunkSurvivesALostHeader`, `TestV11LogOnlyWriteSurvivesTheUpgrade` (`core/storage/chunk_record_v11_upgrade_test.go`) | chunk-kernel/2; CoverageDurable row 199 (the WAL is durable through a published position) (not in this repository) | DORMANT |
|
||||
| `INV-CHUNK-FORMAT-LEVEL-001` | An attach raises a store to the v1.1 format only at the assigned format level 1 (absent = 0); at level 0 a store already on v1.1 is served only over a version-1 HEAD, reported, and refused typed over a version-0 HEAD. | M-format gate (holder) | `core/storage/chunk_v11_format.go` `attachFormat`; `core/storage/chunk_layer.go` `attachChunkLayerImpl`; `core/frontend/chunkstore/layout_remote.go` `SetHeadFormatV11`, `HeadV11` | `TestAttachFormatFollowsTheAssignedLevel`, `TestAttachAtLevelZeroOfAnUpgradedStore` (`core/storage/chunk_format_level_test.go`); `TestLayoutRemoteHeadFormatFollowsItsLayer` (`core/frontend/chunkstore/layout_manifest_size_test.go`) | none | ACTIVE |
|
||||
| `INV-CHUNK-FOREIGN-ROOT-FENCE-001` | A HEAD that moved past the holder's base without superseding it and is not its own proposal must keep the chunk root; one that changed it fences the layer (`errChunkForeignRoot`), so no chunk is held clean against a root that no longer names it. | M5 Commit (head conflict, settlement) | `core/storage/chunk_layer.go` `adoptHeadLocked` (from `captureLocked`, `SettleDetach`, `resolvePending`) | `TestShadowForeignRootWithoutSupersedeFences` (`core/storage/chunk_record_shadow_test.go`) | HeadWriters (only metadata writers move HEAD without superseding; not in this repository) | ACTIVE |
|
||||
| `INV-CHUNK-RECORD-PAYLOAD-001` | Persisting and loading a chunk record preserves every entry's state and hash, including entries on either side of a segment boundary. | M1 chunk record codec (caller not wired) | `core/storage/chunk_record.go` `encodeChunkRecordPage`, `decodeChunkRecordPage` | `TestRecordEntryPayloadRoundTripsAcrossSegments` (`core/storage/chunk_record_test.go`; state-zero and one-entry hash-drop controls) | Encoding fidelity; no state transition change | STUB |
|
||||
| `INV-CHUNK-COVERAGE-INIT-POSITION-001` | Coverage initialization rechecks the captured append position under the final store lock before publishing a fence or replacing live entries; a changed position refuses the candidate. | M1 coverage initialization | `core/storage/chunk_coverage.go` `InitializeChunkCoverage` | `TestChunkCoverageInitializationRefusesAnAppendDuringPagePreparation`, `TestChunkCoverageInitializationCaptureBarrierExcludesPublicWrites` (`core/storage/chunk_coverage_initialization_append_test.go`) | SlotFence.Publish; capture barrier remains the public-write exclusion | ACTIVE |
|
||||
|
||||
@@ -321,6 +321,7 @@ Durable store state of the served volume. Go type `volume.durableStatusBody`.
|
||||
| `Volumes[].Chunk.Stats.UpgradePass.Total` | uint64 | chunks the pass walks |
|
||||
| `Volumes[].Chunk.Stats.UpgradePass.Superseded` | uint64 | Superseded counts chunks written during their own compare (in this process): not hashed, not counted as compared; each is dirty and the next cut takes it as any written chunk. |
|
||||
| `Volumes[].Chunk.Stats.UpgradePass.Outcome` | string | why a failed pass stopped; while the pass has not ended a cut, snapshot, backup or sealing detach is refused with code in_progress (omitted when empty) |
|
||||
| `Volumes[].Chunk.Stats.FormatLevelBehindVolume` | bool | FormatLevelBehindVolume: attached at format level 0 to a store and HEAD already on v1.1 (format_level_behind_volume): served as v1.1. |
|
||||
| `Volumes[].Chunk.Stats.BarrierOverBound` | uint64 | BarrierOverBound counts cuts whose barrier copied more than the bound after the staging rounds. |
|
||||
| `Volumes[].Chunk.Stats.AbsentChunks` | int | AbsentChunks is the number of HEAD-named chunks still absent with a block not local (what HydrateAll would still fetch); 0 = fully local. |
|
||||
| `Volumes[].Chunk.Stats.COWSpillCap` | int64 | COWSpillCap is the last cut's side-file cap in bytes, read once per cut; COWSpillCapReason is why it is 0, when the free space made it so: no_room_to_cut (half the free space is within the 1 GiB reserve) or free_space_unreadable (the free space could not be read). |
|
||||
|
||||
Reference in new issue
Block a user