Skip to content
quarry Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9edc6a5de6ad1f9f62e0bcf146f1a756c7993d6a8e198bbf34a00762c1e7f401
Ticket: 0e488373ecc21aca805e5737517dee9994a2a8cb
Schema changes must migrate online, not wipe every index
User & Date: dmestas on 2026-08-19 10:44:08
Changes

  1. Untracked field cmimetype: "text/x-markdown"
  2. comment changed 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.
    
  3. priority changed to: "High"
  4. severity changed to: "Severe"
  5. status changed to: "Open"
  6. subsystem changed to: "index"
  7. title changed to:
    Schema changes must migrate online, not wipe every index
    
  8. type changed to: "Code_Defect"