diff --git a/seaweed-block/cmd/blockvolume/chunk_maintenance.go b/seaweed-block/cmd/blockvolume/chunk_maintenance.go index b1a926b80c..a42cdc86fd 100644 --- a/seaweed-block/cmd/blockvolume/chunk_maintenance.go +++ b/seaweed-block/cmd/blockvolume/chunk_maintenance.go @@ -58,7 +58,7 @@ func newChunkMaintenance(cat *chunkstore.BCatalog, ref chunkstore.VolumeRef, cle diagnostic = "HEAD generation not read: HEAD absent" } defer func() { - durable.ReportMaintenance(ctx, durable.MaintenancePassStatus{Planned: int64(res.Planned), Removed: int64(res.Removed), PlannedChunks: int64(res.PlannedChunks), PlannedRoots: int64(res.PlannedRoots), PlannedSegments: int64(res.PlannedSegments), RemovedChunks: int64(res.Removed - res.Roots - res.Segments), RemovedRoots: int64(res.Roots), RemovedSegments: int64(res.Segments), HeadGen: head.Gen, HeadGenError: diagnostic}) + durable.ReportMaintenance(ctx, durable.MaintenancePassStatus{SkipReason: head.ListRetirementSkipReason(), Planned: int64(res.Planned), Removed: int64(res.Removed), PlannedChunks: int64(res.PlannedChunks), PlannedRoots: int64(res.PlannedRoots), PlannedSegments: int64(res.PlannedSegments), RemovedChunks: int64(res.Removed - res.Roots - res.Segments), RemovedRoots: int64(res.Roots), RemovedSegments: int64(res.Segments), HeadGen: head.Gen, HeadGenError: diagnostic}) }() var rerr error res, rerr = cat.RemoveUnreachableAll(ctx, ref, me, s) diff --git a/seaweed-block/cmd/blockvolume/maintenance_status_test.go b/seaweed-block/cmd/blockvolume/maintenance_status_test.go index 7d7860a430..f20edbd6e6 100644 --- a/seaweed-block/cmd/blockvolume/maintenance_status_test.go +++ b/seaweed-block/cmd/blockvolume/maintenance_status_test.go @@ -67,7 +67,7 @@ func maintenanceJSON(t *testing.T, p *durable.DurableProvider) map[string]any { } func TestMaintenanceStatusRealPassAndTimeout(t *testing.T) { - for _, kind := range []string{"completed", "reachable", "metadata-only", "head-unread", "head-absent", "retention-only", "timeout"} { + for _, kind := range []string{"completed", "reachable", "metadata-only", "head-unread", "head-absent", "retention-only", "newer-pending-work", "timeout"} { t.Run(kind, func(t *testing.T) { timeout := kind == "timeout" ctx := context.Background() @@ -175,6 +175,22 @@ func TestMaintenanceStatusRealPassAndTimeout(t *testing.T) { if err != nil { t.Fatal(err) } + if kind == "newer-pending-work" { + // Simulate bytes persisted by a future producer, not a v1.1 producer path. + st, e := fixture.Catalog.Store(fixture.Ref) + if e != nil { + t.Fatal(e) + } + before.Version = layout.HeadVersion1 + before.Lists = []layout.ListCursor{{Ref: layout.ListRef{Hash: layout.Sum([]byte("future pending page")).String(), Pages: 1}, Kind: layout.ListUploadIntent, Producer: "future", Generation: 1}} + if e = st.UpdateHead(ctx, before.Gen, before, layout.CauseCommit); e != nil { + t.Fatal(e) + } + before, _, err = fixture.Catalog.ReadHead(ctx, fixture.Ref) + if err != nil { + t.Fatal(err) + } + } if !p.KickMaintenance("v1") { t.Fatal("kick refused") } @@ -245,6 +261,13 @@ func TestMaintenanceStatusRealPassAndTimeout(t *testing.T) { } return } + if kind == "newer-pending-work" { + if last["skipReason"] != "newer_pending_work" || !reflect.DeepEqual(before.Lists, after.Lists) { + t.Fatalf("reserved work silently skipped or consumed: status=%v lists=%v", last, after.Lists) + } + } else if _, present := last["skipReason"]; present { + t.Fatalf("unexpected skip reason: %v", last) + } expectedGen := before.Gen + 1 if kind == "head-unread" || kind == "head-absent" { expectedGen = 0 diff --git a/seaweed-block/core/frontend/chunkstore/layout/head-write-census.json b/seaweed-block/core/frontend/chunkstore/layout/head-write-census.json index 790905b08f..c54de7b0cc 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/head-write-census.json +++ b/seaweed-block/core/frontend/chunkstore/layout/head-write-census.json @@ -7,6 +7,7 @@ }, "semantics": "Allowed field-group changes, not proof that a transition occurred. Compare whole decoded HEAD observations. Every update advances Gen separately. No row permits VolumeID change on an existing HEAD.", "field_groups": { + "lists": "Head.Lists: at most three reserved ProducerSeam cursors; every v1.1 update preserves them; no v1.1 producer or consumer", "volume_id": "Head.VolumeID identity", "epoch": "Head.Epoch", "holder": "Head.Holder", diff --git a/seaweed-block/core/frontend/chunkstore/layout/head.go b/seaweed-block/core/frontend/chunkstore/layout/head.go index cebad80df5..f2068f4bef 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/head.go +++ b/seaweed-block/core/frontend/chunkstore/layout/head.go @@ -182,6 +182,9 @@ type Head struct { // List is the single admitted list continuation. A producer must finish // or settle it before publishing another; HEAD stays bounded. List *ListCursor `json:",omitempty"` + // Lists reserves three further ProducerSeam slots. This binary preserves + // them but never publishes or consumes them. Empty is omitted on write. + Lists []ListCursor `json:",omitempty"` Gen uint64 VolumeID VolumeID @@ -236,6 +239,7 @@ type headDoc struct { State string `json:"state,omitempty"` CurrentBytes *uint64 `json:"current_bytes,omitempty"` List *ListCursor `json:"list,omitempty"` + Lists []ListCursor `json:"lists,omitempty"` Ext json.RawMessage `json:"ext,omitempty"` } @@ -309,6 +313,23 @@ func (h Head) carriesManifestSizes() bool { var ErrNoNextPosition = fmt.Errorf("%w: HEAD position leaves no room for a next LSN", ErrMalformed) func (h Head) check() error { + if len(h.Lists) > 3 || len(h.Lists) != 0 && h.Version != HeadVersion1 { + return fmt.Errorf("%w: reserved lists require version 1 and at most three entries", ErrMalformed) + } + refs := make(map[ListRef]bool, len(h.Lists)+1) + if h.List != nil { + refs[h.List.Ref] = true + } + for _, c := range h.Lists { + if err := c.check(); err != nil { + return err + } + if refs[c.Ref] { + return fmt.Errorf("%w: repeated list reference", ErrMalformed) + } + refs[c.Ref] = true + } + if h.List != nil { if h.Version != HeadVersion1 { return fmt.Errorf("%w: legacy HEAD carries a list", ErrMalformed) @@ -432,7 +453,7 @@ func (h Head) Encode() ([]byte, error) { if err := h.check(); err != nil { return nil, err } - d := headDoc{List: h.List, Version: h.Version, VolumeID: h.VolumeID.String(), Epoch: h.Epoch, Holder: h.Holder, ClaimID: h.ClaimID, Activity: h.Activity, Position: h.Position, State: h.State, CurrentBytes: h.CurrentBytes, Ext: h.Ext} + d := headDoc{Lists: h.Lists, List: h.List, Version: h.Version, VolumeID: h.VolumeID.String(), Epoch: h.Epoch, Holder: h.Holder, ClaimID: h.ClaimID, Activity: h.Activity, Position: h.Position, State: h.State, CurrentBytes: h.CurrentBytes, Ext: h.Ext} if h.Current != nil { d.Current = h.Current.String() } @@ -491,14 +512,14 @@ func DecodeHead(b []byte, gen uint64, volume VolumeID) (Head, error) { if err := dec.Decode(&d); err != nil { return Head{}, fmt.Errorf("%w: HEAD: %v", ErrMalformed, err) } - if d.Version == 0 && (d.List != nil || d.CurrentBytes != nil || d.Ext != nil || snapshotsSized(d.Snapshots) || snapshotsOperated(d.Snapshots)) { + if d.Version == 0 && (d.Lists != nil || d.List != nil || d.CurrentBytes != nil || d.Ext != nil || snapshotsSized(d.Snapshots) || snapshotsOperated(d.Snapshots)) { return Head{}, fmt.Errorf("%w: HEAD of the v1.0 format carries v1.1 fields", ErrMalformed) } vid, err := ParseVolumeID(d.VolumeID) if err != nil { return Head{}, err } - h := Head{List: d.List, Gen: gen, VolumeID: vid, Epoch: d.Epoch, Holder: d.Holder, ClaimID: d.ClaimID, Activity: d.Activity, Position: d.Position, State: d.State, CurrentBytes: d.CurrentBytes, Version: d.Version, Ext: d.Ext} + h := Head{Lists: d.Lists, List: d.List, Gen: gen, VolumeID: vid, Epoch: d.Epoch, Holder: d.Holder, ClaimID: d.ClaimID, Activity: d.Activity, Position: d.Position, State: d.State, CurrentBytes: d.CurrentBytes, Version: d.Version, Ext: d.Ext} if d.Current != "" { rn, err := ParseRootName(d.Current) if err != nil { @@ -619,6 +640,12 @@ func (h Head) clone() Head { if h.List != nil { c.List = h.List.clone() } + if h.Lists != nil { + c.Lists = make([]ListCursor, len(h.Lists)) + for i, cursor := range h.Lists { + c.Lists[i] = *cursor.clone() + } + } if h.Current != nil { rn := *h.Current c.Current = &rn diff --git a/seaweed-block/core/frontend/chunkstore/layout/head_census_export_test.go b/seaweed-block/core/frontend/chunkstore/layout/head_census_export_test.go index 97a431abc6..2e6fc2e340 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/head_census_export_test.go +++ b/seaweed-block/core/frontend/chunkstore/layout/head_census_export_test.go @@ -31,13 +31,13 @@ func TestMachineReadableHeadCensusNamesExactlyTheTypedCauses(t *testing.T) { if census.SchemaVersion != 1 { t.Fatalf("schema=%d", census.SchemaVersion) } - observable := map[string]bool{"list": true, "volume_id": true, "epoch": true, "holder": true, "claim_id": true, "activity": true, "current": true, "position": true, "state": true, "snapshots": true, "snapshots[].Dependents": true, "version": true, "current_bytes": true, "ext": true} + observable := map[string]bool{"list": true, "lists": true, "volume_id": true, "epoch": true, "holder": true, "claim_id": true, "activity": true, "current": true, "position": true, "state": true, "snapshots": true, "snapshots[].Dependents": true, "version": true, "current_bytes": true, "ext": true} for field := range census.FieldGroups { if !observable[field] { t.Fatalf("unobservable census field %s", field) } } - headFields := map[string]bool{"List": true, "Gen": true, "VolumeID": true, "Epoch": true, "Holder": true, "ClaimID": true, "Activity": true, "Current": true, "Position": true, "Snapshots": true, "State": true, "Version": true, "CurrentBytes": true, "Ext": true} + headFields := map[string]bool{"List": true, "Lists": true, "Gen": true, "VolumeID": true, "Epoch": true, "Holder": true, "ClaimID": true, "Activity": true, "Current": true, "Position": true, "Snapshots": true, "State": true, "Version": true, "CurrentBytes": true, "Ext": true} typ := reflect.TypeOf(Head{}) for n := 0; n < typ.NumField(); n++ { if !headFields[typ.Field(n).Name] { @@ -83,8 +83,8 @@ func TestMachineReadableHeadCensusNamesExactlyTheTypedCauses(t *testing.T) { func changedCensusGroups(before, after Head) []string { var out []string a, b := reflect.ValueOf(before), reflect.ValueOf(after) - jsonKeys := map[string]string{"List": "list", "VolumeID": "volume_id", "Epoch": "epoch", "Holder": "holder", "ClaimID": "claim_id", "Activity": "activity", "Current": "current", "Position": "position", "State": "state", "Version": "version", "CurrentBytes": "current_bytes", "Ext": "ext"} - for _, name := range []string{"List", "VolumeID", "Epoch", "Holder", "ClaimID", "Activity", "Current", "Position", "State", "Version", "CurrentBytes", "Ext"} { + jsonKeys := map[string]string{"List": "list", "Lists": "lists", "VolumeID": "volume_id", "Epoch": "epoch", "Holder": "holder", "ClaimID": "claim_id", "Activity": "activity", "Current": "current", "Position": "position", "State": "state", "Version": "version", "CurrentBytes": "current_bytes", "Ext": "ext"} + for _, name := range []string{"List", "Lists", "VolumeID", "Epoch", "Holder", "ClaimID", "Activity", "Current", "Position", "State", "Version", "CurrentBytes", "Ext"} { if !reflect.DeepEqual(a.FieldByName(name).Interface(), b.FieldByName(name).Interface()) { out = append(out, jsonKeys[name]) } @@ -115,6 +115,11 @@ func changedCensusGroups(before, after Head) []string { return out } func TestMachineReadableHeadCensusCoversRealTransitionFieldSets(t *testing.T) { + t.Run("legacy", func(t *testing.T) { checkRealTransitionFieldSets(t, false) }) + t.Run("reserved", func(t *testing.T) { checkRealTransitionFieldSets(t, true) }) +} + +func checkRealTransitionFieldSets(t *testing.T, reserved bool) { raw, err := os.ReadFile("head-write-census.json") if err != nil { t.Fatal(err) @@ -135,10 +140,19 @@ func TestMachineReadableHeadCensusCoversRealTransitionFieldSets(t *testing.T) { newRoot := RootName{Hash: Sum([]byte("new-image"))} base := func() Head { h := idleHead() + if reserved { + h.Version = HeadVersion1 + h.Lists = reservedListsFixture(t) + } h.State = StateLive h.Current = &root h.Position = 5 h.Snapshots = map[string]Snapshot{"daily": {Root: root, Position: 5}} + if reserved { + sn := h.Snapshots["daily"] + sn.Gen = h.Gen + h.Snapshots["daily"] = sn + } return h } snap := func() Head { h := base(); h.Activity = Activity{Kind: ActSnap, Session: "s"}; return h } @@ -189,6 +203,7 @@ func TestMachineReadableHeadCensusCoversRealTransitionFieldSets(t *testing.T) { t.Fatalf("transition did not write exactly once: writes=%d err=%v", store.updates, err) } after := *store.h + assertReservedLists(t, before, after) if after.Gen != before.Gen+1 { t.Fatalf("generation did not advance: %d -> %d", before.Gen, after.Gen) } @@ -231,6 +246,9 @@ func TestMachineReadableHeadCensusCoversExclusiveCreateWriters(t *testing.T) { } check := func(cause HeadWriteCause, h Head) { t.Helper() + if len(h.Lists) != 0 { + t.Fatal("exclusive create populated reserved lists") + } if h.Gen != 1 { t.Fatalf("create generation=%d", h.Gen) } diff --git a/seaweed-block/core/frontend/chunkstore/layout/head_lists_test.go b/seaweed-block/core/frontend/chunkstore/layout/head_lists_test.go new file mode 100644 index 0000000000..d80e870964 --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/layout/head_lists_test.go @@ -0,0 +1,151 @@ +package layout + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "strings" + "testing" +) + +// These bytes are independent of headDoc: changing the codec cannot silently +// change the reserved ProducerSeam representation. +const reservedHeadPrefix = `{"version":1,"volume_id":"00112233445566778899aabbccddeeff","epoch":1,"holder":"a","claim_id":"k","activity":{"kind":"idle"},"position":0` + +func reservedListsGolden() string { + return reservedHeadPrefix + `,"lists":[{"ref":{"hash":"` + strings.Repeat("1", 64) + `","pages":1},"kind":"upload-intent","producer":"upload","generation":1},{"ref":{"hash":"` + strings.Repeat("2", 64) + `","pages":2},"kind":"drop","producer":"cut","generation":2},{"ref":{"hash":"` + strings.Repeat("3", 64) + `","pages":1},"kind":"snapshot-delete-intent","producer":"delete","generation":3,"target":{"name":"daily","gen":1}}]}` +} + +func TestReservedListsDoNotBecomeCompatibilitySweepCandidates(t *testing.T) { + ctx := context.Background() + s, c, p := chainFixture(t) + if _, err := StageListPage(ctx, s, me, "s1", p); err != nil { + t.Fatal(err) + } + if _, err := RunAbort(ctx, s, me, "s1", CauseSessionRollback); err != nil { + t.Fatal(err) + } + if _, err := RunBeginClean(ctx, s, me, "clean"); err != nil { + t.Fatal(err) + } + // Deliberately no active List: this binary must not infer that the page + // is abandoned, nor read/consume the future producer's reserved chains. + s.h.Lists = []ListCursor{c} + before := s.h.clone() + out, err := NewCleaner(s, nil, s, me, "clean").Page(ctx, ListDir, 0, []string{c.Ref.Hash}) + path, _ := c.Ref.Path() + if err != nil || len(out.Names) != 0 || out.After != path { + t.Fatalf("reserved retirement: %+v %v", out, err) + } + assertReservedLists(t, before, *s.h) + if meta, found, err := s.Stat(ctx, path); err != nil || !found || meta.Mark != "" { + t.Fatalf("reserved page changed: %+v %v %v", meta, found, err) + } +} + +func reservedListsFixture(t *testing.T) []ListCursor { + t.Helper() + id, _ := ParseVolumeID("00112233445566778899aabbccddeeff") + h, err := DecodeHead([]byte(reservedListsGolden()), 9, id) + if err != nil { + t.Fatal(err) + } + return h.Lists +} + +func assertReservedLists(t *testing.T, before, after Head) { + t.Helper() + a, _ := json.Marshal(before.Lists) + b, _ := json.Marshal(after.Lists) + if !bytes.Equal(a, b) { + t.Fatalf("reserved lists changed: %s -> %s", a, b) + } +} + +func TestReservedListsValidationAndClone(t *testing.T) { + h := idleHead() + h.Version = HeadVersion1 + h.Lists = reservedListsFixture(t) + // A cursor pins its chain's first generation, not the latest HEAD write. + h.Gen = 99 + h.List = (&ListCursor{Ref: ListRef{Hash: strings.Repeat("4", 64), Pages: 1}, Kind: ListDrop, Producer: "primary", Generation: 1}).clone() + raw, err := h.Encode() + if err != nil { + t.Fatal(err) + } + if _, err := DecodeHead(raw, h.Gen, h.VolumeID); err != nil { + t.Fatal(err) + } + tests := map[string]func(*Head){ + "four additional": func(h *Head) { + extra := *h.List.clone() + extra.Ref.Hash = strings.Repeat("5", 64) + h.Lists = append(h.Lists, extra) + }, + "repeated additional ref": func(h *Head) { h.Lists[1].Ref = h.Lists[0].Ref }, + "repeated primary ref": func(h *Head) { h.Lists[1].Ref = h.List.Ref }, + "legacy": func(h *Head) { h.Version = 0; h.List = nil }, + "hash": func(h *Head) { h.Lists[0].Ref.Hash = "bad" }, + "pages": func(h *Head) { h.Lists[0].Ref.Pages = 0 }, + "kind": func(h *Head) { h.Lists[0].Kind = "unknown" }, + "producer": func(h *Head) { h.Lists[0].Producer = "" }, + "generation": func(h *Head) { h.Lists[0].Generation = 0 }, + "target": func(h *Head) { h.Lists[2].Target.Gen = 0 }, + } + for name, mutate := range tests { + t.Run(name, func(t *testing.T) { + bad := h.clone() + mutate(&bad) + if _, err := bad.Encode(); !errors.Is(err, ErrMalformed) { + t.Fatalf("encode: %v", err) + } + // Marshal headDoc directly to test decoder validation independently of Encode. + d := headDoc{Version: bad.Version, VolumeID: bad.VolumeID.String(), Epoch: bad.Epoch, Holder: bad.Holder, ClaimID: bad.ClaimID, Activity: bad.Activity, List: bad.List, Lists: bad.Lists} + b, err := json.Marshal(d) + if err != nil { + t.Fatal(err) + } + if _, err := DecodeHead(b, bad.Gen, bad.VolumeID); !errors.Is(err, ErrMalformed) { + t.Fatalf("decode: %v", err) + } + }) + } + legacyEmpty := strings.Replace(reservedHeadPrefix, `"version":1,`, "", 1) + `,"lists":[]}` + if _, err := DecodeHead([]byte(legacyEmpty), 9, h.VolumeID); !errors.Is(err, ErrMalformed) { + t.Fatalf("legacy empty lists: %v", err) + } +} + +func TestReservedListsCloneDoesNotAlias(t *testing.T) { + h := idleHead() + h.Version, h.Lists = HeadVersion1, reservedListsFixture(t) + raw, err := h.Encode() + if err != nil { + t.Fatal(err) + } + cloned := h.clone() + cloned.Lists[0].Producer = "changed" + cloned.Lists[2].Target.Name = "changed" + after, err := h.Encode() + if err != nil || !bytes.Equal(raw, after) { + t.Fatalf("clone aliases original: %s, %v", after, err) + } +} + +func TestReservedListsGoldenBytes(t *testing.T) { + id, err := ParseVolumeID("00112233445566778899aabbccddeeff") + if err != nil { + t.Fatal(err) + } + for _, raw := range []string{reservedHeadPrefix + `}`, reservedListsGolden()} { + h, err := DecodeHead([]byte(raw), 9, id) + if err != nil { + t.Fatal(err) + } + encoded, err := h.Encode() + if err != nil || !bytes.Equal(encoded, []byte(raw)) { + t.Fatalf("round trip: %s, %v", encoded, err) + } + } +} diff --git a/seaweed-block/core/frontend/chunkstore/layout/list_chain_test.go b/seaweed-block/core/frontend/chunkstore/layout/list_chain_test.go index bfa0c047fc..9da9ea6872 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/list_chain_test.go +++ b/seaweed-block/core/frontend/chunkstore/layout/list_chain_test.go @@ -430,6 +430,7 @@ func TestListWritesMatchExportedCensus(t *testing.T) { } check := func(cause HeadWriteCause, before, after Head) { t.Helper() + assertReservedLists(t, before, after) if after.Gen != before.Gen+1 { t.Fatal("missing generation step") } @@ -441,6 +442,7 @@ func TestListWritesMatchExportedCensus(t *testing.T) { } ctx := context.Background() s, c, p := chainFixture(t) + s.h.Lists = reservedListsFixture(t) if _, err := StageListPage(ctx, s, me, "s1", p); err != nil { t.Fatal(err) } @@ -463,6 +465,7 @@ func TestListWritesMatchExportedCensus(t *testing.T) { } check(CauseListAdvance, before, after) s, c, p = deleteIntentFixture(t) + s.h.Lists = reservedListsFixture(t) r := deleteIntentReader(t, s) before = s.h.clone() if _, err := StageSnapshotDeletePage(ctx, s, before.Gen, p); err != nil { diff --git a/seaweed-block/core/frontend/chunkstore/layout/remove.go b/seaweed-block/core/frontend/chunkstore/layout/remove.go index 6814dfeb6d..fe3159d97d 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/remove.go +++ b/seaweed-block/core/frontend/chunkstore/layout/remove.go @@ -40,6 +40,18 @@ type RemovalResult struct { After string } +// ListRetirementSkipReason reports opaque work that this binary must preserve. +type ListRetirementSkipReason string + +const SkipNewerPendingWork ListRetirementSkipReason = "newer_pending_work" + +func (h Head) ListRetirementSkipReason() ListRetirementSkipReason { + if len(h.Lists) != 0 { + return SkipNewerPendingWork + } + return "" +} + // Page removes unreferenced metadata (RootDir or SegDir) or chunks (PoolDir, // with shard). Every name is validated before any store effect. Metadata pages // must be visited roots first, then segments, before chunk pages. @@ -161,6 +173,15 @@ func (c *Cleaner) removePlanned(ctx context.Context, rels []string, kind string, } live := map[string]bool{} if kind == ListDir { + // Reserved producer chains are opaque to this binary. Do not retire + // list metadata while any are present: absence from List is not proof + // of abandonment. Serving and the existing List consumer continue. + if h.ListRetirementSkipReason() != "" { + if len(rels) != 0 { + out.After = rels[len(rels)-1] + } + return out, nil + } r, ok := c.os.(ListPageReader) if !ok { return out, errors.New("layout: list removal needs a bounded page reader") diff --git a/seaweed-block/core/frontend/durable/maintenance_status.go b/seaweed-block/core/frontend/durable/maintenance_status.go index 8a33cec78b..6d377c6ed4 100644 --- a/seaweed-block/core/frontend/durable/maintenance_status.go +++ b/seaweed-block/core/frontend/durable/maintenance_status.go @@ -5,6 +5,8 @@ import ( "strings" "sync" "time" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" ) // MaintenanceStatus is process-local observation of the holder's maintenance loop. @@ -17,18 +19,19 @@ type MaintenanceStatus struct { // MaintenancePassStatus describes the last completed or failed pass. type MaintenancePassStatus struct { - AtNs int64 `json:"atNs"` // unix ns when the pass ended - Planned int64 `json:"planned"` // all objects considered for removal - Removed int64 `json:"removed"` // all objects removed - PlannedChunks int64 `json:"plannedChunks"` // chunk objects considered for removal - PlannedRoots int64 `json:"plannedRoots"` // root objects considered for removal - PlannedSegments int64 `json:"plannedSegments"` // segment objects considered for removal - RemovedChunks int64 `json:"removedChunks"` // chunk objects removed - RemovedRoots int64 `json:"removedRoots"` // root objects removed - RemovedSegments int64 `json:"removedSegments"` // segment objects removed - Error string `json:"error"` // one-line callback error; empty when the callback completed - HeadGenError string `json:"headGenError"` // diagnostic HEAD read error; empty when read - HeadGen uint64 `json:"headGen"` // observed cleaning HEAD generation; diagnostic only + SkipReason layout.ListRetirementSkipReason `json:"skipReason,omitempty"` // conservative list-page retirement skip; never changes serving or the pass outcome + AtNs int64 `json:"atNs"` // unix ns when the pass ended + Planned int64 `json:"planned"` // all objects considered for removal + Removed int64 `json:"removed"` // all objects removed + PlannedChunks int64 `json:"plannedChunks"` // chunk objects considered for removal + PlannedRoots int64 `json:"plannedRoots"` // root objects considered for removal + PlannedSegments int64 `json:"plannedSegments"` // segment objects considered for removal + RemovedChunks int64 `json:"removedChunks"` // chunk objects removed + RemovedRoots int64 `json:"removedRoots"` // root objects removed + RemovedSegments int64 `json:"removedSegments"` // segment objects removed + Error string `json:"error"` // one-line callback error; empty when the callback completed + HeadGenError string `json:"headGenError"` // diagnostic HEAD read error; empty when read + HeadGen uint64 `json:"headGen"` // observed cleaning HEAD generation; diagnostic only } type maintenanceSlot struct { diff --git a/seaweed-block/core/host/master/format_gate.go b/seaweed-block/core/host/master/format_gate.go index 432a4d2a50..6538f04618 100644 --- a/seaweed-block/core/host/master/format_gate.go +++ b/seaweed-block/core/host/master/format_gate.go @@ -10,6 +10,7 @@ import ( "sync/atomic" "time" + "github.com/seaweedfs/seaweed-block/core/lifecycle" control "github.com/seaweedfs/seaweed-block/core/rpc/control" "github.com/seaweedfs/seaweed-block/core/rpc/lifecycleclient" "google.golang.org/grpc/codes" @@ -170,6 +171,86 @@ func (h *Host) awaitingFirstReport(server string) bool { return !ok } +// grantStartupWindow is how long a placed volume may wait for its grant on a +// host that has not reported before the status calls it late: the master's +// freshness window (a started holder reports within it). +func (h *Host) grantStartupWindow() time.Duration { + return h.cfg.Freshness.EffectiveFreshnessWindow() +} + +// grantWaitEntry is a placed volume whose holder process on a server has +// not reported (no grant before its report) and that has no line yet. +type grantWaitEntry struct { + volume string + waited time.Duration + late bool // waited past the startup window +} + +// grantWaits computes, once per status snapshot, the complete set of +// (server, volume) grant waits at a level above 0: every placed slot without +// an authority line whose own process on its server has not reported. The +// first-seen times are reconciled against that one set: an entry that left +// it (granted, reported, unplaced, removed) is dropped, a new one starts +// now. The key is server and volume, so waits on different servers never +// reset each other. +func (h *Host) grantWaits(now time.Time) map[string][]grantWaitEntry { + out := map[string][]grantWaitEntry{} + live := map[string]bool{} + // One snapshot at a time reads the placements, computes the set and + // reconciles against it: the read is under the lock, so a snapshot that + // read older placements never reconciles after a newer one and drops an + // entry it started. + h.grantWaitMu.Lock() + defer h.grantWaitMu.Unlock() + if h.grantWait == nil { + h.grantWait = map[string]time.Time{} + } + var placements []lifecycle.PlacementIntent + if stores := h.Lifecycle(); stores != nil { + placements = stores.Placements.ListPlacements() + } + if hook := h.testGrantWaitsRead; hook != nil { + hook() + } + if h.formatLevel() > 0 { + window := h.grantStartupWindow() + for _, p := range placements { + if _, granted := h.Publisher().VolumeAuthorityLine(p.VolumeID); granted { + continue + } + for _, slot := range p.Slots { + if slot.ServerID == "" { + continue + } + if _, reported := h.reads.entry(slot.ServerID, p.VolumeID, h.servedBy(slot.ServerID)); reported { + continue + } + key := slot.ServerID + "\x00" + p.VolumeID + live[key] = true + first, seen := h.grantWait[key] + if !seen { + first = now + h.grantWait[key] = now + } + waited := now.Sub(first) + if waited < 0 { // a caller's now taken before another snapshot started this wait + waited = 0 + } + out[slot.ServerID] = append(out[slot.ServerID], grantWaitEntry{volume: p.VolumeID, waited: waited, late: waited > window}) + } + } + } + for k := range h.grantWait { + if !live[k] { + delete(h.grantWait, k) + } + } + for server := range out { + sort.Slice(out[server], func(i, j int) bool { return out[server][i].volume < out[server][j].volume }) + } + return out +} + // placementTooOld names why server may not be chosen as a placement target // (create, move, restore target, a failover candidate), or "" when it may: // only a KNOWN-old report refuses (r2.875). An unknown server is placeable, diff --git a/seaweed-block/core/host/master/format_level_new_cluster_test.go b/seaweed-block/core/host/master/format_level_new_cluster_test.go index 3f5497ab1e..e2cd395baa 100644 --- a/seaweed-block/core/host/master/format_level_new_cluster_test.go +++ b/seaweed-block/core/host/master/format_level_new_cluster_test.go @@ -4,11 +4,14 @@ import ( "bytes" "os" "path/filepath" + "strings" + "sync/atomic" "testing" "time" "github.com/seaweedfs/seaweed-block/core/authority" "github.com/seaweedfs/seaweed-block/core/lifecycle" + "github.com/seaweedfs/seaweed-block/core/ops" control "github.com/seaweedfs/seaweed-block/core/rpc/control" ) @@ -199,3 +202,162 @@ func TestTheGrantReadsTheHoldersOwnReportNotASiblings(t *testing.T) { t.Fatalf("v's grant after v's own report: err %v, published %v; want granted", err, published) } } + +// On a new cluster an idle unreported host is info: the cluster stays ok. A +// host that holds a placed volume waiting for its grant past the startup +// window is a warning: the nodes degrade the cluster and the condition names +// the volume and its wait (r2.877). Before the window it is still info. +func TestAnIdleUnreportedHostLeavesTheClusterOKALateGrantDegradesIt(t *testing.T) { + r := newIsolationRig(t, false, t.TempDir(), t.TempDir()) + if _, err := r.m.Lifecycle().Nodes.RegisterNode(lifecycle.NodeRegistration{ServerID: "node-b", DataAddr: "127.0.0.1:19321", CtrlAddr: "127.0.0.1:19322"}); err != nil { + t.Fatal(err) + } + condition := func(now time.Time) (ops.ObservationCondition, []ops.NodeEvidence, string) { + snap := r.m.ObservationSnapshot(now) + for _, n := range snap.Nodes { + for _, c := range n.Conditions { + if n.NodeName == "node-b" && c.Reason == "awaiting_first_report" { + return c, snap.Nodes, snap.Status + } + } + } + t.Fatal("node-b has no awaiting_first_report condition") + return ops.ObservationCondition{}, nil, "" + } + c, _, status := condition(time.Now()) + if c.Severity != "info" || status != ops.ObservationStatusOK { + t.Fatalf("an idle unreported host: severity %q, cluster %q; want info and ok", c.Severity, status) + } + r.createVolume(t, "waiting") + r.place(t, "waiting", "node-b") + now := time.Now() + c, nodes, _ := condition(now) // first seen waiting now + if c.Severity != "info" || clusterStatus(nil, nodes) != ops.ObservationStatusOK { + t.Fatalf("a placed volume within its startup window: severity %q; want info", c.Severity) + } + c, nodes, _ = condition(now.Add(r.m.grantStartupWindow() + time.Second)) + if c.Severity != "warning" || clusterStatus(nil, nodes) != ops.ObservationStatusDegraded || !strings.Contains(c.Message, "waiting (waiting") { + t.Fatalf("a placed volume past its startup window: severity %q, nodes status %q, message %q; want a warning naming the volume", c.Severity, clusterStatus(nil, nodes), c.Message) + } +} + +// The grant waits are one reconciled set keyed by server and volume: two +// unreported nodes holding waiting volumes do not reset each other's clocks +// (both turn late together); a node whose process for u reported still shows +// its silent process for v waiting; once v's process reports, v's wait and +// its timer are gone. +func TestGrantWaitsAreReconciledPerServerAndVolume(t *testing.T) { + r := newIsolationRig(t, false, t.TempDir(), t.TempDir()) + for _, n := range []string{"node-b", "node-c"} { + if _, err := r.m.Lifecycle().Nodes.RegisterNode(lifecycle.NodeRegistration{ServerID: n, DataAddr: "127.0.0.1:19341", CtrlAddr: "127.0.0.1:19342"}); err != nil { + t.Fatal(err) + } + } + for vol, node := range map[string]string{"vb": "node-b", "vc": "node-c", "u": "node-c"} { + r.createVolume(t, vol) + r.place(t, vol, node) + } + if err := r.fgProcessHeartbeat("node-c", "proc-u", "u", 1); err != nil { + t.Fatal(err) + } + cond := func(now time.Time, node string) (ops.ObservationCondition, bool) { + for _, n := range r.m.ObservationSnapshot(now).Nodes { + for _, c := range n.Conditions { + if n.NodeName == node && c.Reason == "awaiting_first_report" { + return c, true + } + } + } + return ops.ObservationCondition{}, false + } + start := time.Now() + for _, node := range []string{"node-b", "node-c"} { + c, ok := cond(start, node) + if !ok || c.Severity != "info" { + t.Fatalf("%s at first sight: %+v %v; want an info wait", node, c, ok) + } + } + late := start.Add(r.m.grantStartupWindow() + time.Second) + for node, vol := range map[string]string{"node-b": "vb", "node-c": "vc"} { + c, ok := cond(late, node) + if !ok || c.Severity != "warning" || !strings.Contains(c.Message, vol+" (waiting") || strings.Contains(c.Message, "u (waiting") { + t.Fatalf("%s past the window: %+v %v; want a warning naming %s only (u's process reported)", node, c, ok, vol) + } + } + if err := r.fgProcessHeartbeat("node-c", "proc-vc", "vc", 1); err != nil { + t.Fatal(err) + } + if c, ok := cond(late, "node-c"); ok { + t.Fatalf("node-c after vc's process reported: %+v; want no wait", c) + } + if kept := r.m.grantWaitKept("node-c\x00vc"); kept { + t.Fatal("vc's wait timer outlived its process's report") + } + if kept := r.m.grantWaitKept("node-b\x00vb"); !kept { + t.Fatal("vb's wait timer was dropped by another node's reconcile") + } +} + +// A status snapshot that read the placements before a newer one never +// reconciles after it: snapshot A holds its read (no placement yet) while +// vb is placed on an unreported node and snapshot B is started; B must wait +// for A (the hook lets B through without blocking: only A is held), then +// starts vb's wait at its own time, and that wait stays. Every wait is +// bounded. +func TestAnOlderStatusSnapshotNeverDropsANewerOnesWait(t *testing.T) { + r := newIsolationRig(t, false, t.TempDir(), t.TempDir()) + if _, err := r.m.Lifecycle().Nodes.RegisterNode(lifecycle.NodeRegistration{ServerID: "node-b", DataAddr: "127.0.0.1:19351", CtrlAddr: "127.0.0.1:19352"}); err != nil { + t.Fatal(err) + } + r.createVolume(t, "vb") + nowA := time.Now() + nowB := nowA.Add(time.Second) + var armed atomic.Bool + armed.Store(true) + aDone, bDone := make(chan struct{}), make(chan struct{}) + bRanDuringA := false + r.m.testGrantWaitsRead = func() { + if !armed.CompareAndSwap(true, false) { + return // B, or any later snapshot: not held + } + r.place(t, "vb", "node-b") + go func() { r.m.ObservationSnapshot(nowB); close(bDone) }() + select { + case <-bDone: + bRanDuringA = true + case <-time.After(300 * time.Millisecond): + } + } + go func() { r.m.ObservationSnapshot(nowA); close(aDone) }() // A: read before vb was placed + for name, done := range map[string]chan struct{}{"A": aDone, "B": bDone} { + select { + case <-done: + case <-time.After(10 * time.Second): + t.Fatalf("snapshot %s did not finish", name) + } + } + r.m.testGrantWaitsRead = nil + if bRanDuringA { + t.Fatal("snapshot B reconciled while snapshot A held its older read") + } + first, kept := r.m.grantWaitFirst("node-b\x00vb") + if !kept || !first.Equal(nowB) { + t.Fatalf("vb's wait: first seen %v (kept %v), want %v (started by the newer snapshot, not dropped by the older one)", first, kept, nowB) + } +} + +// grantWaitFirst is the first-seen time the master holds for key. +func (h *Host) grantWaitFirst(key string) (time.Time, bool) { + h.grantWaitMu.Lock() + defer h.grantWaitMu.Unlock() + first, ok := h.grantWait[key] + return first, ok +} + +// grantWaitKept reports whether the master holds a first-seen time for key. +func (h *Host) grantWaitKept(key string) bool { + h.grantWaitMu.Lock() + defer h.grantWaitMu.Unlock() + _, ok := h.grantWait[key] + return ok +} diff --git a/seaweed-block/core/host/master/host.go b/seaweed-block/core/host/master/host.go index 10028bd32a..a3db16fa6f 100644 --- a/seaweed-block/core/host/master/host.go +++ b/seaweed-block/core/host/master/host.go @@ -152,9 +152,14 @@ type Host struct { statusLn net.Listener statusHTTP *http.Server journal *journalIsolation - reads *readsLevels // each server's reported format read level (format_gate.go) - format formatLevelState // the cluster's format level (format_gate.go) - finalizeMu sync.Mutex // serializes the format finalize and host retires (format_gate.go) + reads *readsLevels // each server's reported format read level (format_gate.go) + grantWaitMu sync.Mutex // one status snapshot reads and reconciles the grant waits at a time + grantWait map[string]time.Time // "server\x00volume" -> first seen waiting for its grant without its process's report (format_gate.go grantWaits) + format formatLevelState // the cluster's format level (format_gate.go) + finalizeMu sync.Mutex // serializes the format finalize and host retires (format_gate.go) + // testGrantWaitsRead, when a test sets it, runs after a status snapshot + // has read its placements, still holding grantWaitMu. + testGrantWaitsRead func() // testPublicationAdmission, when a test sets it before Start, wraps each // publication admission: next runs the admission itself. testPublicationAdmission func(ask authority.AssignmentAsk, next func() error) error diff --git a/seaweed-block/core/host/master/observation_snapshot.go b/seaweed-block/core/host/master/observation_snapshot.go index b282fed674..e3ec00bbad 100644 --- a/seaweed-block/core/host/master/observation_snapshot.go +++ b/seaweed-block/core/host/master/observation_snapshot.go @@ -5,6 +5,7 @@ import ( "fmt" "net" "sort" + "strings" "time" "github.com/seaweedfs/seaweed-block/core/authority" @@ -27,13 +28,34 @@ func (h *Host) ObservationSnapshot(now time.Time) ops.ClusterEvidence { cluster.Nodes = observationNodes(snapshot.Nodes, snapshot.Placements) cluster.Volumes = h.observationVolumes(snapshot) + waits := h.grantWaits(now) for i := range cluster.Nodes { - if h.awaitingFirstReport(cluster.Nodes[i].NodeName) { - cluster.Nodes[i].Conditions = append(cluster.Nodes[i].Conditions, ops.ObservationCondition{ - Type: "FormatLevel", Status: "AwaitingReport", Reason: "awaiting_first_report", Severity: "info", // the grant gate keeps it from serving: nothing is degraded by a spare host - Message: fmt.Sprintf("awaiting report: no format read level reported since the master started; no new work until its first heartbeat (cluster format level %d)", h.formatLevel()), - }) + node := cluster.Nodes[i].NodeName + nodeWaits := waits[node] + if !h.awaitingFirstReport(node) && len(nodeWaits) == 0 { + continue } + // Info while the node is idle or its placed volumes wait within their + // startup window; a warning (the cluster degraded) once one has waited + // for its grant past the window (r2.877). Each wait is shown, before + // it is late too. + severity := "info" + message := fmt.Sprintf("awaiting report: no grant to a process of this node before its own report (cluster format level %d)", h.formatLevel()) + if len(nodeWaits) > 0 { + window := h.grantStartupWindow() + parts := make([]string, 0, len(nodeWaits)) + for _, w := range nodeWaits { + state := "within" + if w.late { + state, severity = "past", "warning" + } + parts = append(parts, fmt.Sprintf("%s (waiting %s, %s the %s startup window)", w.volume, w.waited.Round(time.Second), state, window)) + } + message += "; placed volumes waiting for their grant: " + strings.Join(parts, ", ") + } + cluster.Nodes[i].Conditions = append(cluster.Nodes[i].Conditions, ops.ObservationCondition{ + Type: "FormatLevel", Status: "AwaitingReport", Reason: "awaiting_first_report", Severity: severity, Message: message, + }) } cluster.Events = h.events.list("") cluster.Status = clusterStatus(cluster.Volumes, cluster.Nodes) diff --git a/seaweed-block/docs/design/immutable-list-pages.md b/seaweed-block/docs/design/immutable-list-pages.md index 8c261af777..3339f4a829 100644 --- a/seaweed-block/docs/design/immutable-list-pages.md +++ b/seaweed-block/docs/design/immutable-list-pages.md @@ -5,6 +5,27 @@ HEAD CAS and cleaning exclusion. It is dormant: no cut/restore/delete driver calls the producer or consumer yet, and no automatic cleaner policy changes. This is not the final format declaration or the complete V8 producer wiring. +The ProducerSeam r1 encoding reserves four pending-chain slots in HEAD: +existing `list` plus `lists`, an optional array of at most three `ListCursor` +values. New v1.1 volumes leave `lists` empty (canonical JSON omits it). +Every additional cursor passes the existing context/reference checks; no Ref +may repeat within the array or across `list` and `lists`. Version 0 refuses +this field. Every existing HEAD transition preserves the array byte-for-byte, +including the target identities, without consuming it or refusing serving. +When reserved chains are present, the compatibility cleaner retains all list +pages rather than interpreting their future ownership. Maintenance status +reports typed `lastPass.skipReason = newer_pending_work` for that conservative +skip; the reason is omitted normally and does not change the pass outcome. Ordinary `list` +continuation still works. No producer append, upload or handoff is enabled. + +The page format needs no additional field: a later chain extension prepends +one page with Next naming the old head, the same kind/producer/generation and +Pages increased by one. A cursor retains its first publishing generation, +which may be below the enclosing HEAD generation. The kept commit slot is +derived from the future producer protocol, not another durable field. +Fixed-byte empty/three-cursor vectors, invalid-slot/reference controls, deep +clone isolation and every existing HEAD-update cause pin this representation. + Version 1 is compact canonical JSON with keys in this order: `version, volume_id, kind, producer, generation, pages, next?, target?, entries`. Each reference is `{hash, pages}`. A snapshot target is `{name, gen}`. @@ -61,12 +82,12 @@ sequenceDiagram Consumer->>Store: tags -> current HEAD reachability -> conditional mark/delete ``` -HEAD has one optional `list` field, containing `ref`, `kind`, `producer`, +HEAD has an active optional `list` field, containing `ref`, `kind`, `producer`, `generation`, and optional captured `target`. It is a serialized admission slot: a second outstanding chain is refused, never overwrites unfinished work. The slot is bounded and admitted only in version 1; a legacy encoding -cannot carry it. This slot is for reviewing the chain integration, not an -approval of final multi-producer queue capacity. The version remains 1; +cannot carry it. The three reserved `lists` slots are not populated or consumed +by this binary; their presence does not change the active slot admission. The version remains 1; all v1.1 fields belong to the final schema, never to `ext`. Pages are staged by the already-open snap session. The original base diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index 3d33c5d733..5777a5f33a 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -580,6 +580,7 @@ stateDiagram-v2 |---|---|---|---|---| | no lifecycle record | named volume with immutable layout id | master lifecycle create mints the id once; a lost directory-sync reply settles the same record on retry. Lookup resolves the durable name/id without creating one; workload launch carries both and selects a local directory keyed by id | `core/lifecycle/store.go` `CreateVolume`; master `CreateVolume`, `GetVolume`; `core/rpc/lifecycleclient` `ResolveVolume`; launcher `blockVolumeArgs`; blockvolume `parseFlags` | `INV-SNAPK-VOLUME-DIR-001` | | pending ordinary create with a proved id8 collision | pending create with a fresh durable layout id | rejected exclusive VOLUME create, valid foreign full identity belongs to the selected name/id8 directory; not ready, not attached, not a restore; persist replacement before retry, settle unknown rename on replay; never modify the colliding volume | `LayoutStore.CreateVolumeRecord`; `FileStore.RedrawPendingLayoutID`; master `createLifecycleVolume` | `INV-CREATE-DIR-COLLISION-001` | +| any version-1 HEAD with reserved lists | same reserved lists after any existing HEAD transition | at most three additional checked cursors, no repeated Ref across list/lists; deep clone and exact preservation; never consumed or a reason to refuse serving | `head.go` `check`, `clone`, `runTransition`; `remove.go` `Cleaner.Page` retains list metadata | `INV-LIST-RESERVED-001` | | snap(s), list slot empty | snap(s), list cursor published | same full holder, open session and original base generation; every referenced page durable and authenticated; unknown reply retains session and pages | `list_chain.go` `StageListPage`, `RunPublishList` | `INV-LIST-PUBLISH-001` | | clean(c), current list page | clean(c), next continuation or none | exact observed cursor CAS only after authenticated page effects succeed; failed reads and failed effects leave cursor unchanged | `list_chain.go` `RunAdvanceList` | `INV-LIST-CURSOR-001` | | clean(c), stored list page | clean(c), unreached page removed | tags before HEAD; current clean session; spare all current-chain pages; conditional mark then delete | `remove.go` `Cleaner.Page` | `INV-LIST-RETIRE-001` | @@ -1401,6 +1402,7 @@ Notes: | ID | Statement | Transition | Enforced in | Guard | Model | Status | |---|---|---|---|---|---|---| +| `INV-LIST-RESERVED-001` | Version-1 HEAD preserves at most three additional checked list cursors without consuming them or refusing serving; list-page retirement remains conservative while they are present and reports newer_pending_work. | M9 all existing HEAD updates | `core/frontend/chunkstore/layout/head.go` `check`, `clone`; `core/frontend/chunkstore/layout/remove.go` `Cleaner.Page` | `TestMaintenanceStatusRealPassAndTimeout/newer-pending-work`, `TestReservedListsGoldenBytes`, `TestReservedListsValidationAndClone`, `TestReservedListsCloneDoesNotAlias`, `TestReservedListsDoNotBecomeCompatibilitySweepCandidates`, `TestMachineReadableHeadCensusCoversRealTransitionFieldSets`, `TestListWritesMatchExportedCensus` | ProducerSeam r1 E1-E3: Bounded, NoLeak, NoDangling (encoding only; producer deferred) | DORMANT | | `INV-LIST-PUBLISH-001` | A list publication names only durable authenticated pages of its open session; an unknown reply never abandons their protection. | M9 snap -> snap | `list_chain.go` `StageListPage`, `RunPublishList` | `TestPublishList_Closure`, `TestRunPublishList_InterruptAtEveryStep`, `TestListSessionEndedDuringPageWriteCannotPublish` | PageChain 246-250; NoDangling | DORMANT | | `INV-LIST-CURSOR-001` | The persisted list cursor advances only after its authenticated page's idempotent effects finish; a missing page never completes work. | M9 clean -> clean | `list_chain.go` `RunAdvanceList` | `TestAdvanceList_Closure`, `TestRunAdvanceList_InterruptAtEveryStep`, `TestListMissingConsumerPageNeverCompletes` | PageChain 246,251-253; NoLostWork | DORMANT | | `INV-LIST-RETIRE-001` | List-page removal requires a clean session and the existing conditional mark/delete order; every page reached by HEAD is spared, including shared tails. | M9 clean removal | `remove.go` `Cleaner.removePlanned` | `TestListSweepSpareSessionAndReachableTail`, `TestListSharedTailSurvivesAbandonedChainAndResumes`, `TestLayoutStoreListPublishConsumeAndRetire` | PageChain 246,248-251; NoDangling | DORMANT | diff --git a/seaweed-block/docs/status-schema.md b/seaweed-block/docs/status-schema.md index 54efd05c1b..1e40cb8403 100644 --- a/seaweed-block/docs/status-schema.md +++ b/seaweed-block/docs/status-schema.md @@ -240,6 +240,7 @@ Durable store state of the served volume. Go type `volume.durableStatusBody`. | `Volumes[].Chunk.Maintenance.inProgress` | bool | a maintenance callback is running | | `Volumes[].Chunk.Maintenance.currentStartNs` | int64 | unix ns start of the running pass; zero when idle | | `Volumes[].Chunk.Maintenance.lastPass` | object | absent until a pass ends (omitted when empty) | +| `Volumes[].Chunk.Maintenance.lastPass.skipReason` | ListRetirementSkipReason (string) | conservative list-page retirement skip; never changes serving or the pass outcome (omitted when empty) | | `Volumes[].Chunk.Maintenance.lastPass.atNs` | int64 | unix ns when the pass ended | | `Volumes[].Chunk.Maintenance.lastPass.planned` | int64 | all objects considered for removal | | `Volumes[].Chunk.Maintenance.lastPass.removed` | int64 | all objects removed |