pageindex, edge, activator: bound departed-instance metadata
Scopes were never removed from the page index, and the activator's current-inputs cache kept every departed host's merged env, so both grew with deployment history and every reload sorted and reset historical scopes. ResetAndClearOptIn now retires the scope once its mark is gone. Epochs count up from a random start (nextEpoch), so no two states of one process share one; Finish and MarkOptInFor look the scope up rather than create it. A ticket from a retired scope finds no state or a new epoch and never publishes or marks. Each reload (applyPageRoutes) hands the hosts with registry rows to Cache.RetainInputs, which drops other hosts' process inputs and calls the backend's RetainInputs, wired beside CurrentInputs in wireCurrentInputs. Churn tests in pageindex, activator and edge show the retained state stays bounded by the instances on the box.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 files changed,
+279
−24
internal/activator/inputs.go+16 −0internal/activator/inputs_test.go+31 −0internal/edge/cache.go+35 −0internal/edge/pagecache.go+16 −7internal/edge/pagecache_reload_test.go+62 −0internal/host/pagearm.go+5 −2internal/host/pagearm_test.go+14 −2internal/pageindex/index.go+26 −7internal/pageindex/index_test.go+48 −0internal/pageindex/optin.go+19 −5internal/pageindex/pending.go+7 −1
diff --git a/internal/activator/inputs.go b/internal/activator/inputs.go| index 51933d521..c3f9db523 100644 |
| --- a/internal/activator/inputs.go |
| +++ b/internal/activator/inputs.go |
| @@ -185,6 +185,22 @@ func (b *ExecBackend) CurrentInputs(rt registry.Route) (string, bool) { |
| return fp, true |
| } |
| +// RetainInputs drops the cached current-inputs read of every host keep does |
| +// not report: an instance that has left the box (the edge's reload hands |
| +// it the hosts the registry has rows for, Cache.RetainInputs). The cache |
| +// then holds one read per instance on the box, not one per instance ever |
| +// asked about. A read in flight for a departed host may store its entry |
| +// after this; the next reload drops it. |
| +func (b *ExecBackend) RetainInputs(keep func(host string) bool) { |
| + b.inputsMu.Lock() |
| + defer b.inputsMu.Unlock() |
| + for h := range b.inputsCache { |
| + if !keep(h) { |
| + delete(b.inputsCache, h) |
| + } |
| + } |
| +} |
| + |
| // inputsStamp is path's stamp, absent for a missing file. A nested row's |
| // files are read without following a link (instanceEnvParts), so the |
| // stamp is the entry's own; a flat row's read follows one, so its stamp |
diff --git a/internal/activator/inputs_test.go b/internal/activator/inputs_test.go| index 99459b4eb..90d2e0aa0 100644 |
| --- a/internal/activator/inputs_test.go |
| +++ b/internal/activator/inputs_test.go |
| @@ -4,6 +4,7 @@ import ( |
| "context" |
| "os" |
| "path/filepath" |
| + "strconv" |
| "strings" |
| "sync/atomic" |
| "testing" |
| @@ -650,3 +651,33 @@ func TestSplitBackendPublishesInputsForExecRowsOnly(t *testing.T) { |
| t.Fatalf("a process with unknown inputs left %q published", got) |
| } |
| } |
| + |
| +// TestRetainInputsBoundsChurn (final review finding 6): instances come and |
| +// go on a long-running box, each asked for its current inputs while it is |
| +// there. After each departure the backend is told which hosts remain |
| +// (RetainInputs, from the edge's reload), and its cached reads stay bounded |
| +// by the instances on the box. A host that stays keeps its read. |
| +func TestRetainInputsBoundsChurn(t *testing.T) { |
| + defer func(d time.Duration) { inputsStampRacy = d }(inputsStampRacy) |
| + inputsStampRacy = 0 // every stamp old enough to keep |
| + k := newInputsKit(t) |
| + writeOwnEnv(t, k.b, k.rt, "OWN=1\n") |
| + stay := mustCurrent(t, k.b, k.rt) |
| + for i := 0; i < 50; i++ { |
| + rt := k.rt |
| + rt.Host = "i" + strconv.Itoa(i) + ".example.com" |
| + writeOwnEnv(t, k.b, rt, "OWN="+strconv.Itoa(i)+"\n") |
| + mustCurrent(t, k.b, rt) |
| + k.b.RetainInputs(func(h string) bool { return h == k.rt.Host }) |
| + k.b.inputsMu.Lock() |
| + n := len(k.b.inputsCache) |
| + _, kept := k.b.inputsCache[k.rt.Host] |
| + k.b.inputsMu.Unlock() |
| + if n != 1 || !kept { |
| + t.Fatalf("after %d departures the backend holds %d reads (the staying host's kept: %v)", i+1, n, kept) |
| + } |
| + } |
| + if got := mustCurrent(t, k.b, k.rt); got != stay { |
| + t.Fatalf("the staying host's inputs changed: %q, want %q", got, stay) |
| + } |
| +} |
diff --git a/internal/edge/cache.go b/internal/edge/cache.go| index d31139252..ebdc1dda9 100644 |
| --- a/internal/edge/cache.go |
| +++ b/internal/edge/cache.go |
| @@ -92,6 +92,9 @@ type Cache struct { |
| // currentInputs answers a route's current inputs (SetCurrentInputs); |
| // nil answers none. |
| currentInputs func(registry.Route) (string, bool) |
| + // retainInputs is handed the hosts to keep at each reload |
| + // (SetRetainInputs, RetainInputs); nil when none is installed. |
| + retainInputs func(keep func(host string) bool) |
| // bridge reaches the edge's page index from the control socket, which |
| // is handed this Cache and not the Edge (setBridge). Nil: no edge set |
| @@ -269,6 +272,38 @@ func (c *Cache) SetCurrentInputs(f func(registry.Route) (string, bool)) { |
| c.currentInputs = f |
| } |
| +// SetRetainInputs installs the hook RetainInputs hands the hosts to keep: |
| +// the host wires the exec backend's RetainInputs here, so its cached reads |
| +// of departed instances' env files are dropped. |
| +func (c *Cache) SetRetainInputs(f func(keep func(host string) bool)) { |
| + c.inputsMu.Lock() |
| + defer c.inputsMu.Unlock() |
| + c.retainInputs = f |
| +} |
| + |
| +// RetainInputs keeps the page inputs state of the hosts keep reports and |
| +// drops every other host's: the process inputs NoteProcessInputs recorded, |
| +// and, through the installed hook, the current-inputs reads behind |
| +// CurrentInputs. The edge calls it after each reload with the hosts the |
| +// registry has rows for, so the state is bounded by the instances on the |
| +// box, not by its history. The hook runs with no lock of the cache's held. |
| +func (c *Cache) RetainInputs(keep func(host string) bool) { |
| + if c == nil { |
| + return |
| + } |
| + c.inputsMu.Lock() |
| + for h := range c.inputs { |
| + if !keep(h) { |
| + delete(c.inputs, h) |
| + } |
| + } |
| + f := c.retainInputs |
| + c.inputsMu.Unlock() |
| + if f != nil { |
| + f(keep) |
| + } |
| +} |
| + |
| // CurrentInputs is rt's current inputs from the installed hook, asked with |
| // no lock of the cache's held. false with no hook, or when the hook does |
| // not know them. |
diff --git a/internal/edge/pagecache.go b/internal/edge/pagecache.go| index 4091c6d1a..8c5a868e8 100644 |
| --- a/internal/edge/pagecache.go |
| +++ b/internal/edge/pagecache.go |
| @@ -76,11 +76,24 @@ func (e *Edge) EnablePageCache(x *pageindex.Index) { |
| // reset of a scope with no pages touches only memory, and a mark is cleared |
| // only while the index still holds it. A departure's reset and mark clear |
| // are one step (ResetAndClearOptIn), so a recording that passed |
| -// stillCurrent before the reload cannot write the mark back after it. A mark that cannot be removed is |
| -// logged and stays, so the next reload tries again; the reload goes on. |
| +// stillCurrent before the reload cannot write the mark back after it, and |
| +// it retires the scope, so the index keeps no state for departed |
| +// instances. A mark that cannot be removed is logged and stays, so the next |
| +// reload tries again; the reload goes on. Every reload also drops the |
| +// inputs state of hosts with no row (Cache.RetainInputs). |
| func (e *Edge) applyPageRoutes() { |
| + if !e.pageRoutesRead { |
| + return |
| + } |
| + rows := make(map[string]registry.Route, len(e.pageRoutes)) |
| + for _, rt := range e.pageRoutes { |
| + rows[rt.Host] = rt |
| + } |
| + // The inputs state of a host with no row goes with it, so it is bounded |
| + // by the instances on the box (Cache.RetainInputs). |
| + e.cache.RetainInputs(func(h string) bool { _, ok := rows[h]; return ok }) |
| x := e.pages.Load() |
| - if x == nil || !e.pageRoutesRead { |
| + if x == nil { |
| return |
| } |
| scopes := x.Scopes() |
| @@ -88,10 +101,6 @@ func (e *Edge) applyPageRoutes() { |
| return |
| } |
| m := e.current() |
| - rows := make(map[string]registry.Route, len(e.pageRoutes)) |
| - for _, rt := range e.pageRoutes { |
| - rows[rt.Host] = rt |
| - } |
| for _, s := range scopes { |
| rt, ok := rows[s.Instance] |
| switch { |
diff --git a/internal/edge/pagecache_reload_test.go b/internal/edge/pagecache_reload_test.go| index 95b9016ac..417939818 100644 |
| --- a/internal/edge/pagecache_reload_test.go |
| +++ b/internal/edge/pagecache_reload_test.go |
| @@ -12,6 +12,7 @@ import ( |
| "runtime" |
| "strconv" |
| "strings" |
| + "sync" |
| "sync/atomic" |
| "testing" |
| "time" |
| @@ -740,3 +741,64 @@ func TestTunnelMoveFencesInFlightRecording(t *testing.T) { |
| t.Fatalf("a recording begun before the move published: %v %v (%d pages)", published, err, s.pages()) |
| } |
| } |
| + |
| +// TestInstanceChurnLeavesNoState (final review finding 6): instances are |
| +// created, opt in and are deleted, one after another, on one box. After |
| +// each departure's reload the box keeps no page state for any departed |
| +// instance: no page scope in the index, no process inputs in the cache, |
| +// and the current-inputs reads behind CurrentInputs (a stand-in for the |
| +// exec backend's cache, fed through the same hook) hold the instances on |
| +// the box only. The scene's own instance keeps its page and its mark. |
| +func TestInstanceChurnLeavesNoState(t *testing.T) { |
| + s := newPCScene(t, reloadApp) |
| + s.optIn() |
| + var mu sync.Mutex |
| + reads := map[string]bool{} // the hosts the inputs source holds a read for |
| + s.e.cache.SetCurrentInputs(func(rt registry.Route) (string, bool) { |
| + mu.Lock() |
| + reads[rt.Host] = true |
| + mu.Unlock() |
| + return s.currentInputs(rt) |
| + }) |
| + s.e.cache.SetRetainInputs(func(keep func(string) bool) { |
| + mu.Lock() |
| + defer mu.Unlock() |
| + for h := range reads { |
| + if !keep(h) { |
| + delete(reads, h) |
| + } |
| + } |
| + }) |
| + const churn = 30 |
| + for i := 0; i < churn; i++ { |
| + host := "c" + strconv.Itoa(i) + ".example.com" |
| + rt := registry.Route{Host: host, Kind: "instance", Addr: s.b.srv.Listener.Addr().String(), |
| + Status: "ready", Account: "abc", App: "blog", Version: pcBuild} |
| + putRow(t, s.reg, rt) |
| + s.reload() |
| + s.publishFor(rt) |
| + wantCache(t, s.do(http.MethodGet, "http://"+host+"/p"), "miss") |
| + wantCache(t, s.do(http.MethodGet, "http://"+host+"/p"), "hit") |
| + if !s.idx.OptedIn(routeScope(rt)) { |
| + t.Fatalf("%s did not opt in", host) |
| + } |
| + if err := s.reg.Delete(host); err != nil { |
| + t.Fatal(err) |
| + } |
| + s.reload() |
| + if n := len(s.idx.Scopes()); n != 1 { |
| + t.Fatalf("after %d departures the index holds %d scopes, want the scene's 1", i+1, n) |
| + } |
| + if _, ok := s.e.cache.ProcessInputs(host); ok { |
| + t.Fatalf("the cache kept %s's process inputs after it left", host) |
| + } |
| + mu.Lock() |
| + n, gone := len(reads), reads[host] |
| + mu.Unlock() |
| + if gone || n > 1 { |
| + t.Fatalf("after %d departures the inputs source holds %d reads (the departed host's: %v)", i+1, n, gone) |
| + } |
| + } |
| + s.wantMarked(true, "the instance that stayed") |
| + wantCache(t, s.get("/p"), "hit") |
| +} |
diff --git a/internal/host/pagearm.go b/internal/host/pagearm.go| index 7823517c2..f1357828d 100644 |
| --- a/internal/host/pagearm.go |
| +++ b/internal/host/pagearm.go |
| @@ -49,12 +49,15 @@ func armEdgePageCache(getenv func(string) string, dataDir string, store *assetca |
| } |
| // currentInputsSource is what answers a route's current inputs: the exec |
| -// backend. |
| +// backend. RetainInputs forgets the reads of departed instances. |
| type currentInputsSource interface { |
| CurrentInputs(registry.Route) (string, bool) |
| + RetainInputs(keep func(host string) bool) |
| } |
| -// wireCurrentInputs gives the shared edge cache the backend's answer. |
| +// wireCurrentInputs gives the shared edge cache the backend's answer, and |
| +// the backend the edge's word on which hosts are still on the box. |
| func wireCurrentInputs(c *edge.Cache, src currentInputsSource) { |
| c.SetCurrentInputs(src.CurrentInputs) |
| + c.SetRetainInputs(src.RetainInputs) |
| } |
diff --git a/internal/host/pagearm_test.go b/internal/host/pagearm_test.go| index 5102bd981..81d218b6f 100644 |
| --- a/internal/host/pagearm_test.go |
| +++ b/internal/host/pagearm_test.go |
| @@ -79,10 +79,16 @@ func TestArmPageCacheOpenFailureLeavesItOff(t *testing.T) { |
| } |
| } |
| -type fakeInputs struct{} |
| +type fakeInputs struct{ kept map[string]bool } |
| func (fakeInputs) CurrentInputs(rt registry.Route) (string, bool) { return "fp:" + rt.Host, true } |
| +func (f fakeInputs) RetainInputs(keep func(string) bool) { |
| + for _, h := range []string{"shop.example.com", "gone.example.com"} { |
| + f.kept[h] = keep(h) |
| + } |
| +} |
| + |
| // The agent hands the cache the ExecBackend's own method; this keeps the |
| // type honest. |
| var _ currentInputsSource = (*activator.ExecBackend)(nil) |
| @@ -93,10 +99,16 @@ func TestAgentWiresCurrentInputs(t *testing.T) { |
| if _, ok := c.CurrentInputs(rt); ok { |
| t.Fatal("answers before the wiring") |
| } |
| - wireCurrentInputs(c, fakeInputs{}) |
| + src := fakeInputs{kept: map[string]bool{}} |
| + wireCurrentInputs(c, src) |
| if got, ok := c.CurrentInputs(rt); !ok || got != "fp:shop.example.com" { |
| t.Fatalf("CurrentInputs = %q, %v after the wiring", got, ok) |
| } |
| + // The edge's word on which hosts stay reaches the backend. |
| + c.RetainInputs(func(h string) bool { return h == "shop.example.com" }) |
| + if !src.kept["shop.example.com"] || src.kept["gone.example.com"] || len(src.kept) != 2 { |
| + t.Fatalf("RetainInputs reached the backend as %v", src.kept) |
| + } |
| } |
| // TestRunAgentWiresCurrentInputs is the production-wired witness for the |
diff --git a/internal/pageindex/index.go b/internal/pageindex/index.go| index cc2a809c4..072a81b1f 100644 |
| --- a/internal/pageindex/index.go |
| +++ b/internal/pageindex/index.go |
| @@ -113,6 +113,11 @@ type Index struct { |
| mu sync.Mutex // guards scopes only |
| scopes map[Scope]*scopeState |
| + // epochs is the last epoch drawn (nextEpoch). Epochs count up from a |
| + // random start, so no two scope states of this process ever share one: |
| + // a ticket from a retired scope's state cannot match the state made for |
| + // the same scope later (ResetAndClearOptIn). |
| + epochs atomic.Uint64 |
| } |
| // scopeState is one scope's state. Every field but the mark fields is |
| @@ -163,6 +168,7 @@ func Open(cfg Config) (*Index, error) { |
| cfg.LogAge = defaultLogAge |
| } |
| x := &Index{cfg: cfg, scopes: make(map[Scope]*scopeState)} |
| + x.epochs.Store(random64()) |
| cfg.Store.Retain(func(k assetcache.Key) bool { return !assetcache.IsPageKey(k) }) |
| if err := x.loadMarks(); err != nil { |
| return nil, err |
| @@ -177,19 +183,34 @@ func random64() uint64 { |
| return binary.BigEndian.Uint64(b[:]) |
| } |
| +// nextEpoch draws an epoch no scope state of this process has had. |
| +func (x *Index) nextEpoch() uint64 { return x.epochs.Add(1) } |
| + |
| // scope returns s's state, making it with a fresh epoch the first time s is |
| -// touched in this process. |
| +// touched in this process, or since it was retired. |
| func (x *Index) scope(s Scope) *scopeState { |
| x.mu.Lock() |
| defer x.mu.Unlock() |
| st := x.scopes[s] |
| if st == nil { |
| - st = &scopeState{epoch: random64(), records: make(map[Key]record)} |
| + st = &scopeState{epoch: x.nextEpoch(), records: make(map[Key]record)} |
| x.scopes[s] = st |
| } |
| return st |
| } |
| +// retire forgets s's state st, if it is still s's: the scope then holds |
| +// nothing in memory until it is next touched, when it starts on a new |
| +// epoch. The caller holds st.markMu and has reset st, so no render begun |
| +// on st can publish or mark. |
| +func (x *Index) retire(s Scope, st *scopeState) { |
| + x.mu.Lock() |
| + defer x.mu.Unlock() |
| + if x.scopes[s] == st { |
| + delete(x.scopes, s) |
| + } |
| +} |
| + |
| // lookupScope returns s's state, or nil when s has never been touched. |
| func (x *Index) lookupScope(s Scope) *scopeState { |
| x.mu.Lock() |
| @@ -251,10 +272,7 @@ func (x *Index) Reset(s Scope) { |
| return |
| } |
| st.mu.Lock() |
| - old := st.epoch |
| - for st.epoch == old { |
| - st.epoch = random64() |
| - } |
| + st.epoch = x.nextEpoch() |
| st.seq, st.floor, st.log = 0, 0, nil |
| gone := make([]assetcache.Key, 0, len(st.records)) |
| for _, rec := range st.records { |
| @@ -364,7 +382,8 @@ func (x *Index) allScopes() []*scopeState { |
| } |
| // Scopes lists every scope the index holds state for: those touched in this |
| -// process and those with an opt-in mark. They are sorted. |
| +// process and those with an opt-in mark, less those retired since |
| +// (ResetAndClearOptIn). They are sorted. |
| func (x *Index) Scopes() []Scope { |
| x.mu.Lock() |
| out := make([]Scope, 0, len(x.scopes)) |
diff --git a/internal/pageindex/index_test.go b/internal/pageindex/index_test.go| index fc1a2976d..5bc0ee23d 100644 |
| --- a/internal/pageindex/index_test.go |
| +++ b/internal/pageindex/index_test.go |
| @@ -659,3 +659,51 @@ func TestAbortRetriesCleanup(t *testing.T) { |
| }) |
| } |
| } |
| + |
| +// TestDepartedScopesAreRetired (final review finding 6): instance churn on |
| +// a long-running box. Each instance publishes a page and opts in, a render |
| +// takes a ticket, and the instance departs (ResetAndClearOptIn). The index |
| +// keeps no state for any of them afterwards, however many came and went, |
| +// and the ticket each took before it left still never publishes, never |
| +// writes a mark and brings no state back. An instance that returns starts |
| +// on a new epoch. |
| +func TestDepartedScopesAreRetired(t *testing.T) { |
| + r := newRig(t, 64<<20, nil) |
| + x := r.x |
| + const churn = 200 |
| + for i := 0; i < churn; i++ { |
| + s := Scope{Account: "acct-1", App: "shop", Instance: "i" + strconv.Itoa(i) + ".example.com"} |
| + publish(t, x, s, pageKey("/p", ""), "in", "body", nil) |
| + if ok, err := x.MarkOptInFor(x.Begin(s, "in")); !ok || err != nil { |
| + t.Fatalf("mark %s: %v %v", s.Instance, ok, err) |
| + } |
| + stale := x.Begin(s, "in") |
| + p := reserveWrite(t, x, stale, pageKey("/q", ""), "late") |
| + if err := x.ResetAndClearOptIn(s); err != nil { |
| + t.Fatal(err) |
| + } |
| + if finish(t, p, nil) { |
| + t.Fatalf("%s: a ticket from before the departure published", s.Instance) |
| + } |
| + if ok, err := x.MarkOptInFor(stale); ok || err != nil { |
| + t.Fatalf("%s: a ticket from before the departure marked: %v %v", s.Instance, ok, err) |
| + } |
| + if x.OptedIn(s) { |
| + t.Fatalf("%s is still opted in", s.Instance) |
| + } |
| + if n := len(x.Scopes()); n != 0 { |
| + t.Fatalf("after %d departures the index holds %d scopes", i+1, n) |
| + } |
| + if i == churn-1 { |
| + if back := x.Begin(s, "in"); back.Epoch == stale.Epoch { |
| + t.Fatal("a returning instance reuses its departed epoch") |
| + } |
| + } |
| + } |
| + if keys := pageKeys(r.store); len(keys) != 0 { |
| + t.Fatalf("%d page objects survive the churn", len(keys)) |
| + } |
| + if ents, _ := os.ReadDir(r.markDir); len(ents) != 0 { |
| + t.Fatalf("%d mark files survive the churn", len(ents)) |
| + } |
| +} |
diff --git a/internal/pageindex/optin.go b/internal/pageindex/optin.go| index b177089f0..60bdaa2c4 100644 |
| --- a/internal/pageindex/optin.go |
| +++ b/internal/pageindex/optin.go |
| @@ -35,9 +35,13 @@ func markName(s Scope) string { |
| // are serialized with ResetAndClearOptIn by the scope's mark lock. So a |
| // departure either comes after the mark and clears it, or comes before the |
| // check and the mark is never written: a render begun before a departure |
| -// cannot bring the mark back. |
| +// cannot bring the mark back. A scope retired since t was taken has no |
| +// state, or a new one on another epoch, and is not marked either. |
| func (x *Index) MarkOptInFor(t Ticket) (bool, error) { |
| - st := x.scope(t.Scope) |
| + st := x.lookupScope(t.Scope) |
| + if st == nil { |
| + return false, nil |
| + } |
| if st.marked.Load() { |
| // Already durable: nothing is written, so no lock is needed. |
| return st.epochIs(t.Epoch), nil |
| @@ -87,6 +91,13 @@ func (st *scopeState) epochIs(epoch uint64) bool { |
| // begun before it can write the mark after it. It is the step for an |
| // instance that has left the box or switched pages off. When s holds no |
| // mark it does no I/O. |
| +// |
| +// Once the mark is gone the scope is retired: the index forgets its state, |
| +// so departed instances cost no memory and no reload work however many |
| +// come and go. A ticket taken before it still never publishes or marks: |
| +// Finish and MarkOptInFor find no state, or a new one, whose epoch no |
| +// earlier state of this process had (nextEpoch). A mark that cannot be |
| +// removed keeps the scope, for the next call to try again. |
| func (x *Index) ResetAndClearOptIn(s Scope) error { |
| st := x.lookupScope(s) |
| if st == nil { |
| @@ -95,10 +106,13 @@ func (x *Index) ResetAndClearOptIn(s Scope) error { |
| st.markMu.Lock() |
| defer st.markMu.Unlock() |
| x.Reset(s) |
| - if !st.marked.Load() { |
| - return nil |
| + if st.marked.Load() { |
| + if err := x.clearMarkLocked(s, st); err != nil { |
| + return err |
| + } |
| } |
| - return x.clearMarkLocked(s, st) |
| + x.retire(s, st) |
| + return nil |
| } |
| // ClearOptIn removes s's mark and fsyncs the directory. OptedIn reports |
diff --git a/internal/pageindex/pending.go b/internal/pageindex/pending.go| index ddbd95042..5c4562d6b 100644 |
| --- a/internal/pageindex/pending.go |
| +++ b/internal/pageindex/pending.go |
| @@ -108,7 +108,13 @@ func (p *Pending) Finish(m assetcache.Meta, ignore []string) (published bool, er |
| x.cfg.afterCommit() |
| } |
| - st := x.scope(p.t.Scope) |
| + // A scope with no state was retired since the ticket was taken (or |
| + // never had one): nothing of it may be published. |
| + st := x.lookupScope(p.t.Scope) |
| + if st == nil { |
| + x.cfg.Store.Delete(p.phys) |
| + return false, nil |
| + } |
| st.mu.Lock() |
| admit := st.admitsLocked(p.t, p.key) |
| var prev record |