| index 2e2e17469..8c85f7358 100644 |
| --- a/internal/registry/registry.go |
| +++ b/internal/registry/registry.go |
| @@ -643,6 +643,15 @@ func (r *Registry) Delete(host string) error { |
| // -revoke`), SetTunnel (`carlos route -tunnel -`), SetUnit (`carlos route |
| // -unit -`), SetSeed, SetFleetBox, and for `provisioned` the row's own |
| // deletion. |
| +// |
| +// `addrs` and `health` (multi-upstream routing, issue #152) are, by |
| +// contrast, PLAIN overwrites — see their ON CONFLICT clause below — same as |
| +// `addr`, `status` and the rest of the un-preserved majority. That makes |
| +// SetUpstreams (registry.go, next to SetUnit) unsafe to rely on until |
| +// provision.routeFor is taught to carry Record.Addrs/Health onto the Route |
| +// it mints: until then, every reconcile tick's Upsert on that host blanks |
| +// whatever SetUpstreams last wrote, the same way a plain excluded.environment |
| +// once silently unbound a route. |
| func (r *Registry) Upsert(t Route) error { |
| if t.CreatedAt == 0 { |
| t.CreatedAt = time.Now().Unix() |
| @@ -895,9 +904,15 @@ func (r *Registry) SetUnit(host, unit string) error { |
| // SetUpstreams repoints a route's multi-upstream set as a narrow UPDATE — |
| // same rationale as SetChannel/SetUnit: a read-modify-write Upsert racing a |
| // deploy's SetVersions or the activator's SetNextDue would clobber those |
| -// columns, and the provision reconcile pass (the only writer of these two |
| -// columns today) converges them independently of everything else a full-row |
| -// Upsert would touch. addrs is the caller's already comma-joined list ("" = |
| +// columns, and this is meant to be how the provision reconcile pass converges |
| +// them independently of everything else a full-row Upsert would touch. But |
| +// unlike environment/caps/tunnel/provisioned/seed/unit/fleet_box, addrs and |
| +// health are PLAIN overwrites in Upsert (registry.go:684), not |
| +// preserve-when-empty — so today, until provision.routeFor is taught to carry |
| +// Addrs/Health onto the Route it builds, every reconcile tick's Upsert blanks |
| +// whatever a SetUpstreams call just wrote. SetUpstreams is not yet safe to |
| +// rely on in the presence of Upsert traffic on the same host; that wiring is |
| +// the next task's job. addrs is the caller's already comma-joined list ("" = |
| // none); health is the probe-config JSON verbatim ("" = unprobed). Neither |
| // argument is validated here — the rails live at the provision pass's own |
| // door (ValidateShape), which runs before a record ever reaches this column, |