Repository navigation
feat(relay): cell reserve mode: book, admit and demote without the database (off) - #27041
Merged
Merged
Conversation
Jinwoo-H
force-pushed
the
relay-step5-cell
branch
4 times, most recently
from
October 10, 2026 01:22
0577e93 to
6097f66
Compare
3 tasks done
Jinwoo-H
force-pushed
the
relay-step5-core
branch
from
October 10, 2026 05:54
2f27605 to
2feef9e
Compare
…tabase (off) Rebased onto main as one commit after its parent squash-merged.
Jinwoo-H
force-pushed
the
relay-step5-cell
branch
from
October 10, 2026 06:03
5a86f72 to
bc52197
Compare
9 tasks done
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 cell half of "desktops connect without the database". When a cell is switched to reserve mode, a director asks it to hold a seat for a desktop, and the cell lets that desktop in without reading the database. Switched off (the default), nothing changes.
What Changed
All behind the per-cell
admitModeswitch in the cell's Cloud Storage switch file (defaultdb, today's path; flipping back takes effect at the next 5 s read):POST /internal/reserve(directors' rehome credential, like the seat feed). Each booking holds one connection unit until its hello or a 30 s TTL. The cell refusesfullat the director's own placement ceiling (cellPlacementCeiling(hardCap, unobservedBound), never above the socket ceiling),intakewhen its token bucket is empty (intakePerSecswitch; 5/s US, 2/s Asia by default; burst 20),draining,seated-newer {epoch}, oroffoutside reserve mode.dryRunchecks without booking, for the shadow latency gate.ticketCheck=enforce(dark); (4) today's database check.activateControl, no migration-target mark, so it has no lease to renew or release. A control admitted by rule 4 is registered, renewed and released exactly as today. The census PR makes the sweeps skip switched-on cells, and the rollback PR registers the memory-admitted controls on a flip back.Retry-After: 2.POST /internal/demote {epoch, joinedAt}: stops phones for that exact seat now and closes it with 4409 after 60 s. Repeats are one demotion; a rejoin of the same host is a different seat.reserveentries,reservedByon the join a booking admitted,counts.bookings/units/ceiling,intake, andrecentlyLeftin full snapshots.admitMode,intakePerSec,ticketCheck: enforce.Why
The design (§3.2–3.3, §10.1) puts only booking, admitting and reporting in the cell, so every choice can change with a director deploy instead of a ~20 h cell update.
Mixed versions. A pre-step-5 cell ignores the new keys; but
ticketCheck: "enforce"is a bad value to it and voids its whole object (it keeps its last values), so the flag workflow must not writeenforceto an old image. A pre-step-5 director never polls these fields and never reserves.Deviations from the design.
activateControland renewals for every control in reserve mode. Here only memory-admitted controls skip them; a control the database admitted keeps today's lease. That way a cell switched on while some director does not know it degrades to today's behaviour for every host that director placed, instead of leaving them with no lease for the database sweeps to misread. As desktops reconnect through bookings and sticky answers, the cell's per-control writes fall to zero anyway.relay_cellswrite" is scoped to controls. Phones still go through today's database path (acquireActivitywrites the cell row), as §1 says phones are unchanged in step 5; heartbeats still write, or the cell would look dead.Linked Issue
N/A (internal relay redesign, step 5).
Visual Proof
N/A: server-side, no UI.
Testing
cell-reserve-admission.blackbox.test.ts: a real cell whose Postgres pool is wedged and the hello shed armed. A booked host connects at its epoch only; a stranger is shed; a host that just left rejoins from memory at the same epoch but not at another; with the switch off a booking made while it was on is not honoured; demotion names one exact seat.