Repository navigation
fix(relay): keep connected hosts on a reserve cell set to existing-only - #30609
Conversation
…xisting-only A reserve cell keeps no activity rows and its ledger stamps last_activity_at, so the stranded rule read its connected hosts as unserved and re-placed them.
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e41d887b-dad6-4862-a13d-f719aced8373
📒 Files selected for processing: 2
cloud/apps/relay/src/assignment-reserve-mode-census.test.tscloud/apps/relay/src/assignment-store.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| } | ||
| // A reserve cell keeps no activity rows and its ledger stamps last_activity_at, so zero | ||
| // leases proves nothing; a dead one is left to the dead-reserve path and its fence. | ||
| if (await this.mayBeReserveCell(text(existing, 'cell_id'), transaction)) { |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Do not use a stale reserve set as proof that a cell is database-mode.
If this store cached a cell as database-mode before another store switched it to reserve mode, mayBeReserveCell can return false from that stale set after reserve-mode reads fail for more than a minute. When the reserve cell has no activity leases, this guard then allows a connected host to be classified as stranded and moved. Treat an unavailable fresh reserve read as insufficient evidence for stranded reassignment, and test a store with a stale pre-switch cache.
ELI5
When a relay cell is set to "existing hosts only" (we do this during a roll), the director has a safety rule that moves hosts off it if they look like they never managed to connect. On a cell running in the new reserve mode, that rule misread every connected host as "never connected" and would move them, disconnecting desktops that were working fine.
What Changed
The "stranded host" rule in
assignment-store.tsnow stops early for any cell that is, or may be, in reserve mode (the same "unknown counts as reserve" test the other reserve guards use).Before: a reserve cell switched to existing-only between 1 and 15 minutes after its ledger last wrote a host's row had those hosts re-placed on another cell on their next assign, because the cell keeps no activity rows and the ledger's write looks like a fresh grant with nothing behind it.
After: those hosts keep their pin. A reserve cell that has actually died is still handled by the existing dead-reserve-cell path, which requires a fence proof; the stranded rule used to skip that check by declaring the cell live.
Why
The rule's evidence (recent
last_activity_at, zero live activity leases) only means something on a cell that writes activity rows. Reserve cells never do, which is the same reasoncompleteEvacuationand dormancy already refuse or skip them. Guarding inside the rule fixes all three callers (sticky assign, full assign, isolated-incumbent check) at once. Refusing existing-only on reserve cells instead would block rolls, and existing-only is otherwise fine for them.Other readers that treat zero leases as idle were checked and are already guarded: idle regional rehome filters reserve cells, evacuation start/status/completion and dormant rebalance refuse them, and migrations cannot exist on a reserve cell.
Deploy: director only; no cell roll needed.
Linked Issue
N/A (internal follow-up from the step-5 placer design review)
Visual Proof
N/A: relay director logic, no UI.
Testing
vitest run --project=relay --maxWorkers=2: 115 files, 1188 passed. Relaytsc --noEmitclean. Postgres-backed tests not run locally (no test database).Checklist
N/Afor visual proof with reason