Incident Library
  • Root cause
  • Component
  • Symptom
  • Contributing factor
  • Case

Cases4 cases

1 to 4 of 4

  1. Symptoms

    Right after a deploy ran a migration with drop_table to remove a table that was no longer used, database queries started to pile up and crowdworks.jp was hard to reach for about a minute. The migration finally failed on a timeout and the service recovered on its own.

    Trigger

    An engineer's deploy ran a migration that used drop_table to delete a table no longer in use.

    Root cause
    Component
    Contributing factor
    –
    Action items
    • In migrations that may take an exclusive MDL on a high-traffic table, through DDL on the table, adding or removing a foreign key to it, or creating or dropping a table with such a foreign key, run SET SESSION lock_wait_timeout = 3 first
    • Write these migrations with def up and def down instead of def change, setting the timeout before the DDL in both
    • Put only one such DDL in each migration
    • Release migrations that contain such DDL on their own
    • Run them during low-traffic hours
    • Document the rules in db/migrate/README.md
    • Point AGENTS.md at that README so Copilot and other AI agents review migrations against it
    • Add the check to the automatic comment posted on pull requests that change db/migrate
  2. Symptoms

    At 15:18 UTC on 9 December 2025, Railway's backend replicas became unhealthy and stopped serving traffic. Dashboard access, CLI operations, logins, the API and the processing of GitHub-based deployments were disrupted, while running deployments stayed online.

    Trigger

    Engineers merged a database schema change with a data migration at 15:03 UTC, and the migration began applying at 15:17 UTC. It added a nullable column to a heavily used table of about 1 billion rows.

    Root cause
    Component
    Contributing factor
    Action items
    • Increase database connections and reconfigure PgBouncer to work within those limits
    • Fix the long-running query so it no longer causes row lock issues
  3. Symptoms

    At 09:20 UTC on 4 April 2023, seven minutes after a deployment was triggered, Open Collective's service degraded: a migration in the deployment had locked the entire Transactions table in the production database.

    Trigger

    A deployment ran a migration that dropped indexes on the Transactions table and re-created them with CONCURRENTLY, excluding soft-deleted rows.

    Root cause
    Component
    Contributing factor
    Detection

    The degradation of service was noticed at 09:20 UTC, seven minutes after the deployment was triggered.

    Remediation
    • Killed the migration, though the table remained locked
    • Put the frontend into maintenance mode to limit queries
    • Closed the other connections to the database
    • Cancelled the new index creation and restored the old index
    • Restored the frontend and confirmed the issue was resolved
    Action items
    • Add a script that simulates production load locally, using a tool like vegeta
    • Run this kind of migration during specific maintenance windows
    • Create the new index first and drop the old one afterwards in future migrations
    • Insist on a review from another engineer before merging such a pull request
    Lessons

    Dropping the old index before creating the new one was too optimistic under constant production queries, even with CONCURRENTLY, and an unreviewed pull request let it through. Tests locally and on staging did not show the problem because there were no tools to run migrations in stressed environments. Putting the frontend in maintenance mode limited the impact while showing users a clear message.

  4. Symptoms

    Just after a planned Postgres schema migration started, GoCardless received alerts that API requests were timing out. The API was down for about 15 seconds, until the migration went through and the API came back.

    Trigger

    A deploy with a schema migration that renamed the empty invoicing tables and dropped and recreated their foreign key constraints, which referenced some of the most heavily used tables.

    Root cause
    Component
    Contributing factor
    Detection

    Alerts about API requests timing out began just after the schema migration started.

    Lessons

    Avoiding renames of tables in use, table rewrites under an exclusive lock and expensive work while holding one was not enough for GoCardless: a short DDL statement can still cause downtime by waiting in the lock queue behind a long-running query. GoCardless recommends removing long-running queries and transactions from the application and running analytics on an asynchronously updated replica, setting log_min_duration_statement and log_lock_waits to find such queries, setting lock_timeout in migration scripts so a deploy aborts rather than taking the application down, splitting schema changes so locks are held for shorter times, and keeping Postgres up to date. Developers with a console on the production database can cause the same downtime by leaving a transaction open.

Check your cluster for this

These 4 cases involve Database and Schema migration. kubegap audits a Kubernetes cluster for gaps like these, read-only, from Claude Code or Codex; its checks cite public reports like the ones in this library.

By root cause1