Artifacts Associated With Ticket 0e488373ec
Ticket change [9edc6a5de6] (rid 1052) by dmestas on 2026-08-19 10:44:08:
- Untracked field cmimetype: "text/x-markdown"
- comment initialized to:
Bumping `schemaVersion` currently means: every repository's index is wiped and refolded from its store. On this corpus that is a multi-minute, stop-the-world rebuild of 23 stores during which every derived surface — timeline, tickets, search, counts — is empty or wrong. In production it is an outage of the whole forge, triggered by adding a column. It is also a trap rather than a tool, because `Index.Reset` deletes ROWS and never changes SHAPE. So the one thing the version stamp exists to signal is the one thing its remedy cannot perform: on 2026-08-19 a version bump that added five ticket columns wiped every index and then failed every ticket fold with "no such column", because `CREATE TABLE IF NOT EXISTS` cannot widen a table that already exists. ### Required 1. **Additive migration is the default path.** `ALTER TABLE ... ADD COLUMN` plus a bounded backfill, applied online, with no wipe. `Open` already documents this as "the lighter mechanism than a rebuild" and already carries a migration list; new columns belong there. The version bump should be reserved for changes that genuinely cannot be expressed additively. 2. **`Reset` must actually reset the shape** — drop the derived tables and re-exec the schema — or the version mechanism must stop implying it can. Today it silently promises one and delivers the other. 3. **Rebuild online, never in place.** Build into a new index file and swap atomically, so the serving index is never the one being rebuilt. This also removes the exclusive-access deadlock: today `quarry reindex` and `quarry serve` contend for the same files, so the only way to repair a store is to take the forge down. 4. **Stage it.** Reindex one repository, verify it against the store, then continue. Wiping 23 at once turns a recoverable mistake into a corpus-wide one. ### Acceptance Adding a column to a derived table must be shippable with the forge serving traffic throughout, and must not be able to empty an index if the migration is wrong.
- priority initialized to: "High"
- severity initialized to: "Severe"
- status initialized to: "Open"
- subsystem initialized to: "index"
- title initialized to:
Schema changes must migrate online, not wipe every index
- type initialized to: "Code_Defect"
Ticket change [4ecc6ef929] (rid 1105) by dmestas on 2026-08-19 12:10:37:
- subsystem changed to: "index"
Ticket change [628e48c253] (rid 1160) by dmestas on 2026-08-19 12:44:01:
- icomment:
Fixed the substance; one refinement deliberately remains. **1. Additive is codified as the default.** The migration list is now a named `migrations` var whose comment states the policy, and `schemaVersion`'s doc points at it first: an ALTER ships online with the forge serving throughout; bump the version ONLY when the change cannot be expressed additively. **2. Reset now actually resets the shape.** It drops every derived table (fts and its shadows, attachment — which the row-delete list had silently missed — included) and reapplies the schema through the same `applySchema` that Open uses, so "the shape" has exactly one definition, then stamps the version. `TestResetRepairsShape` recreates the incident (a column the file's shape lacks) and proves Reset → refold lands, search corpus included. The version mechanism no longer promises a repair it cannot perform. **3. Repair no longer costs an outage.** `repo.reindex` (POST /api/v1/r/{repo}/reindex, Admin) runs the wipe-and-replay in process while the forge serves. It goes through the ingest lane, so a fleet-wide repair is staged at --ingest-limit stores at a time rather than a stampede; the indexing flag shows on /fleet while it runs; the generation bump drops the memos hanging off the old shape. A nil pipeline refuses cleanly. The offline CLI remains for a stopped server. **4. Staging** already existed — --ingest-limit (default 3) bounds concurrent rebuilds — and is now load-bearing for the op above. **Remaining, out of scope:** a zero-degraded-window rebuild. During an in-process reindex the repo's surfaces serve partial data (flagged as indexing) until the replay lands. The clean fix is running the whole Reset+replay in one WAL transaction so readers keep the old snapshot until commit — plumbing a single tx through the fold batches. Worth doing when a rebuild window on a big store actually hurts someone. - mimetype: "text/x-markdown"
- resolution changed to: "Fixed"
- status changed to: "Fixed"
- icomment:
Ticket change [0c66e75fe8] (rid 12473) by zeitgeist on 2026-09-24 00:53:02:
- Untracked field number: "38"