Repository navigation
feat(relay): directors place on reserve-mode cells from memory (off) - #27047
Merged
Merged
Conversation
Jinwoo-H
force-pushed
the
relay-step5-director
branch
2 times, most recently
from
October 10, 2026 01:06
d94b447 to
d4853e9
Compare
Jinwoo-H
changed the base branch from
relay-step5-core
to
relay-step5-rollback
October 10, 2026 02:39
Jinwoo-H
force-pushed
the
relay-step5-rollback
branch
from
October 10, 2026 06:11
9e4cc29 to
2e86afa
Compare
Rebased onto main as one commit after its parent squash-merged.
Jinwoo-H
force-pushed
the
relay-step5-director
branch
from
October 10, 2026 06:18
b6ee5a7 to
71aa37b
Compare
7 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
This is the director half of "desktops connect without the database". When a cell reports that it is switched on, a director answers a reconnecting desktop from memory, and books new desktops on that cell by asking the cell to hold a seat. Every other desktop keeps today's path. Off by default.
What Changed
All behind
ORCA_RELAY_RESERVE_PLACEMENT(offdefault,dry-run,on; director deploy) and, per request, only for cells whose appliedadmitModeisreserve(the per-cell switch, read from each cell's seat feed):sticky: true, no intake token).seated-newer; then today's database path if the region has database-mode cells,503+Retry-After1–10 s if switched-on cells have seats but no budget, else a spill tous-central1, else the database path.placeFreshhook inassign, outside any transaction). Every database mint now takes the map's highest epoch as a floor.max(seat, booking, recently-left) + 1; a host the map never saw costs one primary-key read, and gets503while the database is down.503 Retry-After: 1(only with the switchonand some cell switched on).POST /internal/demote {epoch, joinedAt}, once per minute at most; the winner is reported for the ledger writer.dry-run. For each real fresh placement, the would-be cell is asked to check a booking without making it; outcomes and p50/p99 latency are logged per minute. Never changes an answer (the design's reserve-latency gate).reserveentries,reservedBy,recentlyLeft), leniently.Why
Design §3–§6 rev 2: every director places and the cell decides, with no placer services. 84–94 % of last night's refused reconnects were desktops queueing to re-check, in the database, the cell they were already on; the sticky answer from memory removes that path for switched-on cells.
Deviations from the design.
503for ≤ 30 s) rather than a Cloud Run startup probe: it needs no Terraform change and only applies when the switch is on.Linked Issue
N/A (internal relay redesign, step 5).
Visual Proof
N/A: server-side, no UI.
Testing
reserve-assignment.test.ts: off and no-switched-on-cell keep today's path; the startup gate and its cap; a reconnect answered from memory with no booking and no database read; a restarted cell re-booked first; a drained leaver booked elsewhere above every known epoch; a host last seen on a database-mode cell keeps today's path with its floor; one row read for a never-seen host,503with the database down; pacing; one demotion per duplicate; dry-run books nothing.cell-reserve-client.test.ts: batching, answer mapping, every failure shape readsunreachable.assigncalls are byte-identical when the switch is off (existing call-shape tests unchanged).Stacked on #27043 (one chain: #27038 → #27041 → #27043 → this → #27048 → #27046 → #27096), so the relay-server.ts and app.ts changes it shares with the cell PRs are merged once here.