A Deployment That Could Not Be Rolled Back
A database migration included in the same deployment as application code made rollback impossible after the new version broke production.
Overview
A deploy that shipped an API response change and a column rename together broke old mobile clients, and the rename made rolling back impossible.
What happened
The bundle held two changes: a new response shape for /api/v1/orders and a migration renaming orders.status to orders.fulfillment_status. Both passed in staging together.
In production, four parties were involved: the team, the 8 production instances, the old mobile app still used by 12% of users, and the database. The incident unfolded in seven steps.
- The team deployed the new API code and the column rename to all 8 instances.
- The database renamed orders.status to fulfillment_status.
- The old mobile app requested /api/v1/orders.
- Production answered with the new response shape, and the app failed.
- Within 3 minutes PagerDuty fired, with a 34% error rate.
- The team rolled back the app code.
- The old code queried orders.status, the database answered that the column does not exist, and every query failed.
Reverting the rename was no way out either, because it would undo 2 hours of writes.
Key concepts
- Expand-contract migration
- Backward-compatible migration
- Blue-green deployment
- Database view
Interview questions
- What is the expand-contract pattern and how does it make database deployments safe to roll back?
Sign up free to read the full topic
More War Stories topics
- A Failed Migration That Left the Database in a Partial State
- A Feature Flag Change That Triggered a Production Outage
- Accidental DELETE Without a WHERE Clause in Production
- An IAM Misconfiguration That Let a Developer Become Admin
- AWS Credentials Committed to a Public GitHub Repository
- Backups That Were Never Actually Completing
- BGP Route Leak That Rerouted Traffic Through an Unexpected AS
- Blue-Green Deployment That Resulted in Split-Brain Sessions
- Cache Stampede on a Flash-Sale Product Page
- Connection Pool Exhaustion That Brought Down 12 Microservices
- DynamoDB Hot Partition That Throttled a Flash Sale
- Failover to a Lagging Replica Lost 4 Minutes of Orders
Start free on Cariara · Coding problems · System design studio