05.2.4 · Skill in Release engineering

Rollback strategies

Undoing a bad release quickly.

A rollback plan means a bad release costs minutes instead of hours. Options include redeploying the previous version, turning off a flag or rolling forward with a fix. Data changes are the hard part, so migrations need their own plan.

Your status · Rollback strategies

Saved in this browser. Sign in to keep it on every device.It colours this skill's tile on your map.

Why it matters for a product engineer

Every release can go wrong. A rollback plan decides whether a bad release costs minutes or a long night. Code is usually easy to undo. Data is not: a migration that drops a column or rewrites records can make the old version useless. So the plan has to be ready before the release, not invented during the incident.

How to do it

  1. Before each release, write how you would undo it: redeploy the previous version, turn off a flag, or switch traffic back.
  2. Make the database change backwards-compatible: add first, migrate, and remove the old parts only in a later release.
  3. Keep the previous version ready to run, and know the command or button that brings it back.
  4. Decide in advance which signal triggers a rollback, so nobody debates it during the incident.
  5. Practise it. A rollback nobody has run will not work the first time.
  6. Afterwards, find out why the problem passed your checks.

Common mistakes

  • No plan until something breaks.
  • Migrations that cannot be reversed, shipped together with the code that needs them.
  • Rolling forward with a quick fix under pressure, when rolling back would be safer.
  • Rollbacks that depend on the system that is failing.

Example

At Mamitsu, every pull request carries its own rollout and rollback plan. Unai Esteibar’s first question about any feature is about database migrations and how to roll back, because that keeps the blast radius small. A referee agent checks the plan before merging. After a merge, an agent watches the logs and rolls back if something breaks. That has happened once. (Mamitsu in In practice)

Flow

From a Slack conversation to production

PlanBuildDecideReleasePRNot readyFeature talkMigrations,rollbackPi agentsCode and proofHermesDelegates, opensthe PRRefereeScores the riskRollbackOnce so farMerge, watchIf low riskUnai approvesIf high riskPlanBuildDecideReleasePRNot readyFeaturetalkMigrations,rollbackPi agentsCode andproofHermesDelegates,opens the PRRefereeScores theriskRollbackOnce so farMerge,watchIf low riskUnaiapprovesIf high risk

The way back is planned in the first conversation, checked before the merge and used after it when needed.

ReportedUnai Esteibar, on the call

Sources: Blue green deployment (Martin Fowler) ↗

In practice

Real products

Resources

2

Tools

1
Tools for Release engineering