mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 19:17:28 +01:00
Reserve bounded producer list cursors in the v1.1 HEAD format
This commit is contained in:
1 parent
f0050b0465
commit
4c90321088
8 files changed
+240
-10
No files matched your search
@@ -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",
|
||||
|
||||
@@ -153,6 +153,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
|
||||
@@ -207,6 +210,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"`
|
||||
}
|
||||
|
||||
@@ -279,6 +283,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)
|
||||
@@ -393,7 +414,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()
|
||||
}
|
||||
@@ -452,14 +473,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)) {
|
||||
if d.Version == 0 && (d.Lists != nil || d.List != nil || d.CurrentBytes != nil || d.Ext != nil || snapshotsSized(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 {
|
||||
@@ -580,6 +601,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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -161,6 +161,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 len(h.Lists) != 0 {
|
||||
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")
|
||||
|
||||
@@ -5,6 +5,25 @@ 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. 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 +80,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
|
||||
|
||||
@@ -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` |
|
||||
@@ -1301,6 +1302,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. | M9 all existing HEAD updates | `core/frontend/chunkstore/layout/head.go` `check`, `clone`; `core/frontend/chunkstore/layout/remove.go` `Cleaner.Page` | `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 |
|
||||
|
||||
Reference in new issue
Block a user