forge
Explore
Log in

Don't you dare go Hollow

🧹 stop the migration comments claiming a fleet

Browse files at this commit

079af733724445fa3e94c46c7bc4cdbdf4246866Ahmet Kaan GümüşParent: c47fb00
  • docs
    • 🧹 stop the migration comments claiming a fleet
Show full message
docs: 🧹 stop the migration comments claiming a fleet

Multi-replica support was deleted; the rate_limit row is restart
continuity for one process, the capacity/delete guards close write skew
between concurrent request tasks, and the = NONE seeds are about
migrate() rerunning on an existing volume — not about a peer serving.
Comment prose only; no SQL byte changed.
src/migration_sql.rsmodified+22 -17
@@ -189,11 +189,12 @@ pub const MIGRATION: &str = "
189 -- claim columns it needs no PRE_REPAIR — the table just goes.189 -- claim columns it needs no PRE_REPAIR — the table just goes.
190 REMOVE TABLE IF EXISTS migration_lock;190 REMOVE TABLE IF EXISTS migration_lock;
191 191
192- -- How much of a rate-limit budget the whole fleet has spent in one wall192+ -- How much of a rate-limit budget one client has spent in one wall window
193- -- window (2026-07-27). One row per tier+client+window, id-keyed so every193+ -- (2026-07-27). One row per tier+client+window, id-keyed so a restart of
194- -- replica lands on the same record; `hits` is the cross-replica total each194+ -- the process lands back on the same record; `hits` is the durable total
195- -- replica folds its local admits into (see `crate::rate_limit`). Rows are195+ -- the in-memory bucket folds its local admits into (see
196- -- swept by the same task once their window is past.196+ -- `crate::rate_limit`), which is what carries a window across a restart.
197+ -- Rows are swept by the same task once their window is past.
197 DEFINE TABLE IF NOT EXISTS rate_limit SCHEMAFULL;198 DEFINE TABLE IF NOT EXISTS rate_limit SCHEMAFULL;
198 DEFINE FIELD IF NOT EXISTS hits ON rate_limit TYPE int DEFAULT 0;199 DEFINE FIELD IF NOT EXISTS hits ON rate_limit TYPE int DEFAULT 0;
199 DEFINE FIELD IF NOT EXISTS window_start ON rate_limit TYPE int;200 DEFINE FIELD IF NOT EXISTS window_start ON rate_limit TYPE int;
@@ -207,8 +208,9 @@ pub const MIGRATION: &str = "
207 DEFINE FIELD IF NOT EXISTS audience.role ON event TYPE option<string>;208 DEFINE FIELD IF NOT EXISTS audience.role ON event TYPE option<string>;
208 DEFINE FIELD IF NOT EXISTS audience.course ON event TYPE option<record<course>>;209 DEFINE FIELD IF NOT EXISTS audience.course ON event TYPE option<record<course>>;
209 DEFINE FIELD IF NOT EXISTS audience.capacity ON event TYPE option<int>;210 DEFINE FIELD IF NOT EXISTS audience.capacity ON event TYPE option<int>;
210- -- Seats taken on the signup list, the cross-replica capacity guard (see211+ -- Seats taken on the signup list, the stored capacity guard that closes
211- -- `crate::domain::cap`). Absent reads as zero, so no Rust struct needs it.212+ -- write-skew between concurrent request tasks (see `crate::domain::cap`).
213+ -- Absent reads as zero, so no Rust struct needs it.
212 DEFINE FIELD IF NOT EXISTS registration_count ON event TYPE option<int>;214 DEFINE FIELD IF NOT EXISTS registration_count ON event TYPE option<int>;
213 REMOVE FIELD IF EXISTS audience.users ON TABLE event;215 REMOVE FIELD IF EXISTS audience.users ON TABLE event;
214 DEFINE FIELD IF NOT EXISTS starts_at ON event TYPE option<int>;216 DEFINE FIELD IF NOT EXISTS starts_at ON event TYPE option<int>;
@@ -233,8 +235,9 @@ pub const MIGRATION: &str = "
233 DEFINE FIELD IF NOT EXISTS name ON term TYPE string;235 DEFINE FIELD IF NOT EXISTS name ON term TYPE string;
234 DEFINE FIELD IF NOT EXISTS starts_at ON term TYPE int;236 DEFINE FIELD IF NOT EXISTS starts_at ON term TYPE int;
235 DEFINE FIELD IF NOT EXISTS ends_at ON term TYPE int;237 DEFINE FIELD IF NOT EXISTS ends_at ON term TYPE int;
236- -- Courses still linking this term, the cross-replica delete guard (see238+ -- Courses still linking this term, the stored delete guard that closes
237- -- `crate::domain::cap`). Absent reads as zero, so no Rust struct needs it.239+ -- write-skew between concurrent request tasks (see `crate::domain::cap`).
240+ -- Absent reads as zero, so no Rust struct needs it.
238 DEFINE FIELD IF NOT EXISTS course_count ON term TYPE option<int>;241 DEFINE FIELD IF NOT EXISTS course_count ON term TYPE option<int>;
239 242
240 DEFINE TABLE IF NOT EXISTS course SCHEMAFULL;243 DEFINE TABLE IF NOT EXISTS course SCHEMAFULL;
@@ -254,7 +257,7 @@ pub const MIGRATION: &str = "
254 DEFINE FIELD IF NOT EXISTS description ON subject TYPE string;257 DEFINE FIELD IF NOT EXISTS description ON subject TYPE string;
255 -- How many exam questions and how many homework still point here. The258 -- How many exam questions and how many homework still point here. The
256 -- delete is conditioned on both reading zero, which is what makes the259 -- delete is conditioned on both reading zero, which is what makes the
257- -- guard hold against a question created on another replica.260+ -- guard hold against a question created by a concurrent request task.
258 DEFINE FIELD IF NOT EXISTS exam_question_count ON subject TYPE option<int>;261 DEFINE FIELD IF NOT EXISTS exam_question_count ON subject TYPE option<int>;
259 DEFINE FIELD IF NOT EXISTS homework_count ON subject TYPE option<int>;262 DEFINE FIELD IF NOT EXISTS homework_count ON subject TYPE option<int>;
260 DEFINE INDEX IF NOT EXISTS subject_course ON subject FIELDS course;263 DEFINE INDEX IF NOT EXISTS subject_course ON subject FIELDS course;
@@ -886,7 +889,8 @@ pub const BACKFILL: &str = "
886 -- the owning row is addressed directly rather than searched for; an UPDATE889 -- the owning row is addressed directly rather than searched for; an UPDATE
887 -- of a record that isn't there (graded absent work) is an empty no-op. The890 -- of a record that isn't there (graded absent work) is an empty no-op. The
888 -- `= NONE` guard keeps it one-time, for the same reason the counters below891 -- `= NONE` guard keeps it one-time, for the same reason the counters below
889- -- are one-time — a peer replica is serving while this runs.892+ -- are one-time — migrate() runs again on every boot against a volume the
893+ -- live system has been writing to since.
890 FOR $r IN ((SELECT VALUE id FROM homework_result) ?? []) {894 FOR $r IN ((SELECT VALUE id FROM homework_result) ?? []) {
891 UPDATE type::record('homework_submission', record::id($r))895 UPDATE type::record('homework_submission', record::id($r))
892 SET graded_by_result = $r WHERE graded_by_result = NONE;896 SET graded_by_result = $r WHERE graded_by_result = NONE;
@@ -897,9 +901,9 @@ pub const BACKFILL: &str = "
897 -- that predates the column is seeded from the children it actually has.901 -- that predates the column is seeded from the children it actually has.
898 -- Runs LAST, after the sweeps above have deleted whatever they delete.902 -- Runs LAST, after the sweeps above have deleted whatever they delete.
899 --903 --
900- -- Deliberately one-time (`= NONE` guards every write): a peer replica is904+ -- Deliberately one-time (`= NONE` guards every write): migrate() reruns on
901- -- serving while this boots, and recomputing a counter it is concurrently905+ -- every boot of an existing volume, and recounting a seeded counter would
902- -- incrementing would hand back a seat that is already taken. An absent906+ -- overwrite what the live system has maintained since. An absent
903 -- counter reads as zero, so the group pass runs before the zero pass.907 -- counter reads as zero, so the group pass runs before the zero pass.
904 FOR $row IN ((SELECT course, count() AS n FROM enrollment GROUP BY course) ?? []) {908 FOR $row IN ((SELECT course, count() AS n FROM enrollment GROUP BY course) ?? []) {
905 UPDATE $row.course SET enrollment_count = $row.n WHERE enrollment_count = NONE;909 UPDATE $row.course SET enrollment_count = $row.n WHERE enrollment_count = NONE;
@@ -974,9 +978,10 @@ pub const BACKFILL: &str = "
974 -- published for it, and a name is removable exactly while its counter reads978 -- published for it, and a name is removable exactly while its counter reads
975 -- zero. Rows written before the counters existed are counted once here.979 -- zero. Rows written before the counters existed are counted once here.
976 --980 --
977- -- Same `= NONE` guard and the same reason as the caps above: a peer replica981+ -- Same `= NONE` guard and the same reason as the caps above: migrate()
978- -- may already be serving, and recomputing a counter it is incrementing982+ -- reruns on every boot of an existing volume, and recounting a seeded
979- -- would hand back a reference that is still held. No zero pass either — an983+ -- counter would overwrite what the live system has maintained since, handing
984+ -- back a reference that is still held. No zero pass either — an
980 -- absent counter already reads as zero, and a name nobody ever used needs985 -- absent counter already reads as zero, and a name nobody ever used needs
981 -- no row at all.986 -- no row at all.
982 --987 --
tests/limits_completeness.rsmodified+1 -1
@@ -176,7 +176,7 @@ const EXCLUDED: &[(&str, &str)] = &[
176 // it is reconciled at — publishing that would invite pacing against it.176 // it is reconciled at — publishing that would invite pacing against it.
177 (177 (
178 "RATE_SYNC_INTERVAL_SECS",178 "RATE_SYNC_INTERVAL_SECS",
179- "how often a replica reconciles its counters",179+ "how often the process folds its counters into the database",
180 ),180 ),
181 ("RATE_SYNC_TIMEOUT_SECS", "deadline on one sync round"),181 ("RATE_SYNC_TIMEOUT_SECS", "deadline on one sync round"),
182 (182 (