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

Start free on Cariara · Coding problems · System design studio