The Incident: The Rollback That Could Not Go Back
Incident Hook
Tuesday. A release of the backend renames a column: username becomes login, in one migration, together with the code that uses the new name. The tests pass - the new code and the new schema fit together. It reaches production at 10:05; the migration takes under a second.
10:40. The new release has a bug on an unrelated page. Mira, on call, does what Chapter 10 taught: a pull request that sets the previous image tag. Merged at 10:50, rolled out at 10:55. Every pod is Ready, and every login and every registration now fails. Before the rollback, one page was broken; now nobody can log in.
11:05. Teo proposes the fix that sounds safest: the WAL archive is healthy, restore the database to 10:04, before the migration. The restore runs into a new cluster (Chapter 12), the backend is pointed at it, and logins work again at 11:40.
The next morning, support has the other half of the story: every account registered between 10:05 and 10:55 is gone - 214 of them, on the first day of a campaign - and those users cannot log in, because for the database they never existed.
10:05 release: RENAME COLUMN username TO login + code that reads login
10:40 bug on one page
10:55 rollback of the image -> every login fails: the old code reads username
11:40 database restored to 10:04 -> logins work; every write since 10:04 gone
Result: 45 minutes in which nobody could log in, then the users’ writes of the whole morning gone - to fix a bug on one page. The rollback followed the book; the book was written for releases that change only code.
The lab reproduces the middle of it on your cluster - a column the code reads disappears, and the image rollback does not help - and then shows what the platform does instead.
Observed Symptoms
- Flux applied the rollback, the pods run the previous digest and are Ready - and every login returns
500. - The backend’s log, on every login:
column "username" does not exist (SQLSTATE 42703). - The schema has no
usernamecolumn; the previous release’s code knows no other. - After the restore, logins work - and users who registered in the morning get invalid credentials.
Confusion Phase
The team argues about the wrong things:
- the rollback worked by every measure the team has - Flux, the digest, Ready pods - so why is it worse?
- should the migration be rolled back too - and who writes that SQL, under pressure, for production?
- is it the restore that lost the data, or the release?
Was the problem the rollback - or a release that left no schema the previous code could run on?
What AI Would Propose (Brave Junior)
- “We have point-in-time recovery: restore the database to 10:04, before the migration. That is what backups are for.”
- “Write the reverse migration now -
RENAME COLUMN login TO username- and run it withpsqlin production.” - “Build a hot fix on the laptop and push it, it is faster than the pipeline.”
Why This Is Dangerous
- An image rollback is safe only if the previous release runs on the schema the database has now. For the old code, a renamed column is a dropped column. The rollback did exactly what it was told; the release had made it impossible.
- A point-in-time restore rewinds everyone’s data, not just the schema. It is the answer to lost or corrupted data (Chapter 12), not to a code mistake. Every write since the restore point - registrations, changes, payments - is gone, and nothing tells the users.
- A reverse script written during an incident is untested DDL on production. A rename back loses nothing; the next one may be a
DROP. And by hand, it is not in Git - the next environment never gets it. - A hot fix from a laptop is an image nobody built, scanned or signed (Chapters 10 and 17).
Pause and Predict: The release had added a column login instead of renaming username, and the new code had written to both. Would the rollback at 10:50 have worked - and what, if anything, would have been lost?