Keep the builds every want names and each composition's provisioner plans; find the replaced controller in the build records (issue 1945)
With no plan left to name a build or a send to keep the plans, a want names what a collection must keep, and the composition is where the provisioner's plans are composed for the assignments mirror (ADR 0539 clauses 1 and 5); the assignments no longer name a node's build, so the controller replaced is the newest earlier build of it.
This commit is contained in:
@@ -408,6 +408,18 @@ func sortedPlanKeys(plans map[string]Provisioning) []string {
|
||||
// (migration 0100) by module, and carried by the assignments mirror in each handed module's assignment. So the
|
||||
// client is handed the plan of the build its machine was sent, and a controller started afresh mirrors the same.
|
||||
|
||||
// RecordComposedPlans keeps the provisioner's plan of each module a node's composition hands to it, as JSON by module
|
||||
// (`<module>: plan and required-by`), or none: what SentProvisioningPlans reads for the assignments mirror (design 57 P6).
|
||||
// With no send left, the composition is where the plans are composed (novox/hq ADR 0539 clause 5).
|
||||
func (i *Inventory) RecordComposedPlans(ctx context.Context, node string, plans []byte) error {
|
||||
var kept any
|
||||
if len(plans) > 0 {
|
||||
kept = plans
|
||||
}
|
||||
_, err := i.store.Pool().Exec(ctx, `update node set sent_provisioning = $2 where name = $1`, node, kept)
|
||||
return err
|
||||
}
|
||||
|
||||
// SentProvisioningPlans is every plan the machines were last sent, keyed `<node>.<module>`: what
|
||||
// SetProvisioningPlans is given. A plan of a module only pulled in by another is kept with what required it, and is
|
||||
// mirrored in a value of its own until a send drops it (issue 765). A plan of a module assigned when it was sent and
|
||||
|
||||
Reference in New Issue
Block a user