# Rollback

> Going back to the last version that worked when a new one causes problems.

- Level: Basic
- Topics: Cloud, Software
- URL: https://tidbit.legios.com.ar/rollback/
- In Spanish: [Rollback](https://tidbit.legios.com.ar/es/rollback/)

A **rollback** is undoing a change by returning a system to an earlier state that was known to be good. The most common case is software releases: a team publishes version 3 of an app, error reports start pouring in, and instead of hunting for the bug while users suffer, they put version 2 back. The investigation can happen calmly afterwards.

A fast rollback is one of the best safety nets a team can have, and modern tooling makes it routine. Kubernetes keeps the previous versions of a deployment and can return to one with a single command. Cloud deployment services can roll back on their own when health checks or alarms fail. Release styles like canary releases and blue-green deployments are designed partly so that going back is quick and only a few users notice the problem.

The hard part is usually data. Code can be swapped back in seconds, but if version 3 changed the database, for example by renaming a column, version 2 may no longer understand it. That is why careful teams make database changes in small, backward-compatible steps. Sometimes rolling back is not possible or not worth it, and the team "rolls forward" instead with a quick fix. The word is also used for databases: a transaction that fails is rolled back, so none of its changes are kept.

## An analogy

Like the undo button in a text editor, but for a whole system: if the last change broke things, you go back to how it was a moment ago.

## Keep in mind

- Returns a system to the last version known to work.
- Fixes the symptom fast; the root cause is investigated afterwards.
- Database changes are what usually make rolling back hard.
- In databases, a failed transaction is rolled back so nothing half-done is kept.

## Go deeper

- [Rolling back a Deployment (Kubernetes docs)](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#rolling-back-a-deployment)
- [Redeploy and roll back a deployment with CodeDeploy (AWS docs)](https://docs.aws.amazon.com/codedeploy/latest/userguide/deployments-rollback-and-redeploy.html)
- [Rollback (data management) on Wikipedia](https://en.wikipedia.org/wiki/Rollback_(data_management))

## Related terms

- [Bug](https://tidbit.legios.com.ar/bug/): A mistake in software that makes it behave differently from what was intended.
- [Kubernetes](https://tidbit.legios.com.ar/kubernetes/): The system that runs and babysits containers across many machines.
- [Deployment](https://tidbit.legios.com.ar/deployment/): Getting a new version of software from the team's computers to real users.
- [Cloud computing](https://tidbit.legios.com.ar/cloud-computing/): Renting computers over the internet instead of buying your own.
- [Canary release](https://tidbit.legios.com.ar/canary-release/): Releasing a new version to a small slice of users first, and widening only if it behaves.
- [Blue-green deployment](https://tidbit.legios.com.ar/blue-green-deployment/): Releasing a new version next to the old one and switching traffic over at once.
- [Database](https://tidbit.legios.com.ar/database/): An organized store of data that programs can search and update safely.
