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

Cases8 cases

5 to 8 of 8

  1. Symptoms

    On 20 September 2023 the sprint 82 production deployment of TANF-app failed with a disk space error while it ran a large search-index migration, search_indexes 0017, against the production PostgreSQL database on cloud.gov. Production could not be deployed again until 9 November.

    Trigger

    The sprint 82 deployment on 20 September 2023 recreated the deleted search_indexes migration 0016 and ran the large migration search_indexes 0017 against the production database.

    Root cause
    Component
    Contributing factor
    Detection

    The sprint 82 production deployment failed with a disk space error, and the large migration search_indexes 0017 was identified as the cause.

    Remediation
    • Increased the production database instance size and re-ran the migrations
    • Created a backup of the production database
    • Truncated all of the search_indexes tables
    • Redeployed the sprint 82 release
    • Fixed the bug that stored empty fields as blank strings
    Action items
    • Write troubleshooting steps for database problems into the technical documentation
    • Write wiki pages and operations playbooks that outline common problems and responses
    • Add a database section and the cf revisions command to the failed-deployment troubleshooting document
    • Keep a GitHub repository of changes made directly to production
    • Save terminal output from production debugging sessions
    • Create Django migration best practices to enforce in code reviews
    • Do not edit migrations that have been merged to develop; write a new migration instead
    • Rename auto-generated migrations to more descriptive names
    • Use one auto-generated migration per model change and regenerate when a pull request makes successive changes
    • Organise a discussion on database seeding and backups for testing
    Lessons

    The work was unplanned and pulled in many developers from a small team, so the team wants documentation and playbooks that let fewer people step away from current work. Large datasets and unexpected edge cases such as rows without space-fill had not been tested, and a copy of the production database with PII scrubbed would allow tests against real-world data. Deploying in-progress code to other environments and changing migrations afterwards had caused conflicts there.

  2. 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.

  3. Symptoms

    On 27 November 2021 at 20:40 UTC, a significant part of GitHub's MySQL read replicas entered a semaphore deadlock while a schema migration on a large MySQL table ran its final step, the rename that moves the updated table into place. Core GitHub services, including GitHub Actions, API Requests, Codespaces, Git Operations, Issues, GitHub Packages, GitHub Pages, Pull Requests and Webhooks, became degraded.

    Trigger

    The final rename step of a schema migration on a large MySQL table. Schema migrations are a common task at GitHub and often take weeks to complete.

    Root cause
    Component
    Contributing factor
    Remediation
    • Promoted every healthy internal replica into the production path to add read capacity
    • Removed production traffic from the broken replicas until each had processed the table rename
    • Moved the recovered replicas back into production to restore capacity
    Action items
    • Continue functional partitioning so migrations can run in canary mode on a single shard
    • Update internal procedures to increase how much each cluster is over-provisioned
    • Pause schema migrations until it is known how to safeguard against this failure
    • Keep investigating the specific failure scenario
    • Test the migration tooling and classify ways to improve it for this kind of scenario
  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 8 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 cause2

Software defect2 cases

Organisation
  1. IL-0451 Setting indexes INVISIBLE on Aurora MySQL 3.10 spiked CPU and ReadIOPS on all three readers but not on the writer
    Daangn2026
  2. IL-0385 GitHub MySQL read replicas hit a semaphore deadlock during a schema migration's table rename and kept crash-recovering
    GitHub2021

Faulty deployment6 cases

  1. IL-0570 Dropping an unused MySQL table stalled queries on its busy parent table and crowdworks.jp was hard to reach for a minute
  2. IL-0369 Railway's backend API went down when a column migration waited on locks and replicas could not get database connections
  3. IL-0554 A database migration used up Sentry US's Postgres connections, and the site and event ingestion were down for 22 minutes
    Sentry2024
  4. IL-0523 TANF-app production deployments were blocked for two months when a search-index migration ran out of database disk space
  5. IL-0524 An index migration locked Open Collective's whole Transactions table and degraded the service for nearly an hour
  6. IL-0391 GoCardless API requests timed out for about 15 seconds while a Postgres migration waited for an AccessExclusive lock