内核 分支迁移预演 —— CI 里拦下生产事故
- 一句话
- 对生产数据的 CoW 分支跑迁移预演:6 个"CI 全绿"的普通迁移里 5 个被拦下(锁阻塞 2.2–8.8 秒、2,133,579 行静默误删),三轮全量复现结论一致。Rehearse migrations on a copy-on-write branch of production data: 5 of 6 "CI-green" ordinary migrations were caught (lock stalls of 2.2–8.8s, a silent 2,133,579-row delete), with identical verdicts across three full reproduction runs.
- 窄场景
- schema 高频演进、用 GitHub Actions 跑迁移的 Postgres 团队;fixture 测试已不够用、但不敢直接在 staging 上试生产的阶段。Postgres teams with frequent schema evolution running migrations through GitHub Actions; the stage where fixture tests no longer suffice but nobody dares rehearse on staging against production.
- 机制
- CoW 分支秒级创建(453MB/400 万行库,20 次实测 2.3–3.1 秒);分支带完整生产数据,包括历史脏数据(大小写重复邮箱、1.5 万个无手机号早期用户、三年期订单);四道门禁:迁移完成、应用读写可用、无单查询 >1s 阻塞、行数无损;neonctl
branches schema-diff对账;单迁移全流程(建分支→跑→删)13–30 秒。CoW branches spin up in seconds (a 453MB / 4M-row database: 2.3–3.1s across 20 measured runs); each branch carries full production data including historical dirt (case-duplicated emails, 15k phone-less early users, three years of orders); four gates — migration completes, app reads/writes keep working, no single query blocked >1s, no rows lost; neonctlbranches schema-difffor reconciliation; full cycle per migration (create → run → delete) 13–30s. - 生产验证
- DevOps-Daily 独立实测(2026-09-24),方法论与 repo 全开源(The-DevOps-Daily/neon-migration-rehearsal),三轮复现 verdicts 完全一致;分支测得的锁阻塞时长与生产实测重叠(分支 8.3–9.0s vs 生产 8.2–8.5s),作者自承"回答量级不回答精确秒数";附带证实 Neon quirk:
connection_uriAPI 默认返回 pooled 串,迁移必须用pooled=false(https://devops-daily.com/posts/rehearse-migrations-on-a-neon-branch)。Independent hands-on test by DevOps-Daily (2026-09-24), methodology and repo fully open source (The-DevOps-Daily/neon-migration-rehearsal), verdicts identical across three runs; measured lock-stall durations on branches overlapped with production itself (branch 8.3–9.0s vs production 8.2–8.5s) — the author states it answers "order of magnitude, not exact seconds"; incidentally confirmed a Neon quirk: theconnection_uriAPI returns the pooled string by default, migrations must usepooled=false(https://devops-daily.com/posts/rehearse-migrations-on-a-neon-branch). - 竞品差距
- PlanetScale 的 deploy request 是 schema 评审流(无真实数据);传统 staging 恢复慢、数据陈旧;fixture 测试"只能证伪自己能看见的"。PlanetScale's deploy request is a schema-review flow (no real data); traditional staging restores are slow and stale; fixture tests "can only disprove what they can see".
- 证据等级
- 独立第三方实测(方法论公开、repo 可复现、三轮复现;小样本已自承)——这是 Neon 上线以来首个公开的、可复现的独立社区实测。Independent third-party test (public methodology, reproducible repo, three runs; small sample openly acknowledged) — the first public, reproducible independent community test of Neon since launch.
- 最后核验
- 2026-10-112026-10-11