Cases2 cases
1 to 2 of 2
IL-0554A database migration used up Sentry US's Postgres connections, and the site and event ingestion were down for 22 minutesSentry2024- Symptoms
From 3:42 PM to 4:04 PM PT on 10 October 2024, the Sentry US site and event ingestion were unavailable, and the status page reported an issue with the Postgres database that made the site unavailable. The dashboard, the API and every US ingestion type, including errors, transactions, attachments, profiles, replays, spans, cron monitoring and custom metrics, were affected.
- Trigger
A database migration ran certain database operations through the RunSQL command without lock and statement timeouts.
- Root cause
- Component
- Contributing factor
- Remediation
- Issued a fix, after which the dashboard and ingestion recovered
- Action items
- Replace RunSQL commands with more robust solutions in the migration framework
- Update the database framework to the latest version, which handles some operations RunSQL was used for
- Write runbooks for recovering from lock or timeout issues during migrations
- Improve alerting and observability so the team reacts sooner
- 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.
These 2 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
Faulty deployment2 cases
- Component
- Contributing factor