A-480..A-484a: a held provider's provides, the one place for a running build's manifest, the composition tool's deadlock fix #236
@@ -172,19 +172,20 @@ func ComposeIn(in Input, node string, mode Mode) (Declared, []string, error) {
|
||||
return d, validate.Declaration(body), nil
|
||||
}
|
||||
|
||||
// composeWithoutStoreFetchers is resolution.Compose where a module that fetches from the artifact store while the node reaches
|
||||
// composeWithoutStoreFetchers (it answers the modules it left out, and why) is resolution.Compose where a module that fetches from the artifact store while the node reaches
|
||||
// none (resolution.NoStoreError, whatever the shape: an image, a source, a tools bundle, a runtime program, a templates
|
||||
// archive) is left out of the declaration with its words and the rest composes again; the node is never refused whole for it
|
||||
// (design 47 G A-461, A-452). The rendering returned carries the modules so left out, for the filter and the rest to read.
|
||||
func composeWithoutStoreFetchers(plan catalogue.Resolution, with catalogue.Rendering) (catalogue.Composed, catalogue.Rendering, error) {
|
||||
func composeWithoutStoreFetchers(plan catalogue.Resolution, with catalogue.Rendering) (catalogue.Composed, catalogue.Rendering, map[string]string, error) {
|
||||
var held map[string]string
|
||||
for {
|
||||
composed, err := resolution.Compose(plan, with)
|
||||
var none *resolution.NoStoreError
|
||||
if !errors.As(err, &none) {
|
||||
return composed, with, err
|
||||
return composed, with, held, err
|
||||
}
|
||||
if _, already := with.NotPlaced[none.Module]; already {
|
||||
return catalogue.Composed{}, with, err
|
||||
return catalogue.Composed{}, with, nil, err
|
||||
}
|
||||
left := make(map[string]string, len(with.NotPlaced)+1)
|
||||
for m, why := range with.NotPlaced {
|
||||
@@ -192,6 +193,10 @@ func composeWithoutStoreFetchers(plan catalogue.Resolution, with catalogue.Rende
|
||||
}
|
||||
left[none.Module] = none.Error()
|
||||
with.NotPlaced = left
|
||||
if held == nil {
|
||||
held = map[string]string{}
|
||||
}
|
||||
held[none.Module] = none.Error()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +217,7 @@ func (c *composer) declaration(nodeName string, mode Mode) (Declared, error) {
|
||||
with := rendered.Rendering
|
||||
with.Generators = gens
|
||||
plan := resolved.Plan
|
||||
composed, with, err := composeWithoutStoreFetchers(plan, with)
|
||||
composed, with, storeHeld, err := composeWithoutStoreFetchers(plan, with)
|
||||
if err != nil {
|
||||
return Declared{}, err
|
||||
}
|
||||
@@ -226,7 +231,21 @@ func (c *composer) declaration(nodeName string, mode Mode) (Declared, error) {
|
||||
if err != nil {
|
||||
return Declared{}, err
|
||||
}
|
||||
out := Declared{Held: resolved.Held, Resources: composed.Resources, Adoption: adoptionFor(plan, node, composed),
|
||||
// A module that fetches from a store no node reaches is held with its words, as a module whose claim cannot be held is: it
|
||||
// stays on the build it runs, its composition kept (A-452, A-461).
|
||||
held := resolved.Held
|
||||
if len(storeHeld) > 0 {
|
||||
held = make(map[string]string, len(resolved.Held)+len(storeHeld))
|
||||
for m, why := range resolved.Held {
|
||||
held[m] = why
|
||||
}
|
||||
for m, why := range storeHeld {
|
||||
if _, said := held[m]; !said {
|
||||
held[m] = why
|
||||
}
|
||||
}
|
||||
}
|
||||
out := Declared{Held: held, Resources: composed.Resources, Adoption: adoptionFor(plan, node, composed),
|
||||
Received: composed.Received, Mesh: with.Mesh, BusUsers: with.BusUsers,
|
||||
LeftOut: sortedKeysOf(composed.LeftOut), LeftOutWhy: composed.LeftOut,
|
||||
Withheld: rendered.Withheld, Unbound: rendered.Unbound,
|
||||
|
||||
@@ -92,12 +92,13 @@ func (c *composer) places(nodeName string, resolved Resolved) (Placed, error) {
|
||||
r.MeshRange = c.overlayRange()
|
||||
|
||||
// The artifact store as this node reaches it now, with what the mesh has built.
|
||||
// Where no address is known (the holder opens no listen to the mesh, or two), only the modules that fetch from the store
|
||||
// wait, with the words of an unanswered requirement; the node composes the rest (design 47 G A-461, A-452).
|
||||
// No address for any reason read without error (no holder, a holder laid by its name alone, a holder not on the private
|
||||
// network, a holder opening no listen to the mesh, or two) holds only the modules that fetch from the store: they wait,
|
||||
// with the words of an unanswered requirement, and the node composes the rest (design 47 G A-461, A-461e, A-452). A fault
|
||||
// reading the inputs still refuses the node (A-461b).
|
||||
store, err := c.artifactStoreAddress(nodeName)
|
||||
var noAddress *storeListenError
|
||||
if errors.As(err, &noAddress) {
|
||||
// Only the store holder's listen refusal holds its fetchers; any other error still refuses the node (A-461b).
|
||||
store, err = "", nil
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
@@ -383,6 +383,13 @@ func TestTheStoreIsFoundByTheImageSeatsHolderAndItsListen(t *testing.T) {
|
||||
if why := d.LeftOutWhy[m]; !strings.Contains(why, "nothing provides") || !strings.Contains(why, "no artifact store") {
|
||||
t.Errorf("%s, which fetches from the store, waits with %q", m, why)
|
||||
}
|
||||
// Held, not only left out: it stays on the build it runs and its handed composition is kept (A-452).
|
||||
if why := d.Held[m]; !strings.Contains(why, "nothing provides") {
|
||||
t.Errorf("%s, which fetches from the store, is held with %q", m, why)
|
||||
}
|
||||
}
|
||||
if _, held := d.Held["plain"]; held {
|
||||
t.Errorf("a module that fetches nothing from the store is held")
|
||||
}
|
||||
if why, held := d.LeftOutWhy["plain"]; held {
|
||||
t.Errorf("a module that fetches nothing from the store waits: %q", why)
|
||||
|
||||
Reference in New Issue
Block a user