Post mortem on Linear incident from Jan 24th, 2024
A database migration using `TRUNCATE TABLE ... CASCADE` on two new, unused tables silently wiped every production table with foreign keys to them, including issue and document descriptions, comments, notifications and reactions. Layered caching in Linear's sync engine hid the loss for about 30 minutes, and sync-lag warnings were excluded from alerting. Because point-in-time recovery had never been tested, the team restored a full backup from hours earlier, causing an hour of downtime and five hours of lost changes. They then replayed sync-engine action logs per workspace, with dry-runs first, recovering over 99% of data within 36 hours; follow-ups include revoking TRUNCATE privileges, linting migrations, PITR tooling and a read-only mode.
Related posts
- Incident Report: September 22nd, 2025
Railway mediumAdeptA schema change removing an unused column was partially reverted by a later code change, breaking a core API and leaving Railway's project canvas stuck loading. After a 15-minute fix, the backlog of queued deployments flooded the Control Plane, whose PgBouncer pooler had been silently upgraded several versions when Railway moved off deprecated Bitnami images. The new version consumed abnormal CPU and memory under load, likely from a changed default configuration. Deployments were shed by tier and the database scaled up, but recovery came only after rolling PgBouncer back, which gave a 100x performance improvement. Follow-ups include CI schema compatibility checks, PgBouncer metrics alerting, phased pooler upgrades, and moving Control Plane storage off Postgres.
- Incident 2023-12-04: Data leak and loss in some free tier databases
Turso mediumAdeptA migration bug introduced on November 20 left 0.07% of Turso free-tier databases with an empty backup identifier, so they all pointed at a shared S3 prefix (s3://bucket//) instead of per-database paths. When scale-to-zero databases on fly.io couldn't be resumed and were recreated from backup, they restored from this shared location, leaking data across tenants. The fix re-ran the migration and restored each affected database from its correct December 1 backup, discarding later writes. Remediation includes control- and data-plane checks that backups match their database, stricter allowed configurations with self-healing, safer migrations and better security reporting channels.
- Incident Report: October 28th, 2025
Railway mediumAdeptA schema migration that added an indexed column to a ~1 billion-row Postgres table without `CREATE INDEX CONCURRENTLY` took an exclusive table lock, queuing nearly all backend API queries and taking down Railway's dashboard, CLI, Public API and GitHub webhook deploys for about 40 minutes. Blocked requests piled up until PgBouncer exceeded Postgres's connection limit, exhausting even reserved administrative slots, so engineers could not connect to kill the index build. The outage ended only when the build finished on its own after roughly 30 minutes. Fixes include a CI check that requires `CONCURRENTLY` for every index creation, PgBouncer pool limits capped below Postgres capacity, and per-user connection limits that keep admin access available.
- I Dropped a Table in Production—Now What?
Neon mediumAdept
Neon's instant point-in-time recovery creates a new copy-on-write branch at a moment just before a dropped table. That branch is available in about one second regardless of database size, and production keeps running while it is created. Two recovery routes follow from this. One is to pg_dump the table out of the recovered branch and import it into production, which keeps all data written after the drop. The other is to use Branch Restore to swap production onto the recovered branch under the same connection string, which discards post-drop writes. RDS, by contrast, restores a snapshot to a new instance and replays WAL, which can take hours for multi-terabyte databases.
- I don't trust ON DELETE CASCADE
PlanetScale mediumAdeptPostgres ON DELETE CASCADE turns a single-row delete into an unbounded transaction that can cause outages at scale. The cascade holds RowExclusiveLock on every table in the tree, so a migration requesting AccessExclusiveLock queues behind it and blocks all later writes. It can also generate hundreds of gigabytes of WAL that stall synchronous replication, and it falls back to sequential scans on unindexed foreign keys. With logical replication it can leave orphaned rows on subscribers, which skip cascade triggers, and it fails outright on published tables lacking a replica identity. The recommended alternative is soft deletes via a deleted_at column, followed by batched background reaping and vacuum, keeping transactions to hundreds or low thousands of rows.