carlos / platform Public

Multi-box fleets: a box re-waking an instance boots its own stale local DB Issue closed

Found while investigating #457 phase 1b, by reading main at d3908d93. Not reproduced. No production fleet has more than one box as far as I know (dev r10r has one), so nothing is affected today. Every multi-box fleet is exposed, though, and managed fleets will create them.

Hazard. On a non-HA host, a box that wakes an instance and finds its own local DB from an earlier hold uses it as a warm cache without checking the bucket for newer data (internal/activator/backend_exec.go:882-883). The comment at activator.go:2583-2589 says this "holds only while a region has one box". On a fleet, every box mints every record of the fleet (inScope, reconcile.go:487-499), and whichever wins the per-host Litestream lease serves. So box A serves, then B takes over (A dark, or the rootfs resident race in rootfs_service.go:723-743), and later A wins again and boots its stale copy. Writes made on B are lost from A's point of view.

TestTwoBoxFleetEndToEnd models the lease and fakes the boxes, so it never exercises restore.

Fix direction (to land in #457 phase 1b, unless someone needs it sooner): on a fleet box, discard the local DB on acquire unless this box was the last holder (the HA path already decides this with hafresh.DecideKeep). Open question: does Litestream itself refuse a stale local DB? That would soften this.

Fixed by #457 phase 1b (main 8294a52, in v0.33.0): on a fleet box, the start rule sets a stale local copy aside when the record's assignment changed and restores from the fleet bucket. Verified on dev 2026-10-31: drillcheck written on box-2, drained to box-1, served the same value from box-1 after restore. Closing.