Skip to content

Deployments & config rollout · 8 of 8

Step 1 · The pattern

One table, many readers

Three servers answer users by reading the name column of one shared table. The pipeline can change two things: the code on a server, or the schema of the table. Those are separate actions and they never land in the same instant.

  • request
  • read worked
  • a change

In short

Expand, migrate, contract: how it works and how it breaks

A database column, a message field or a label that other systems select on is a shared contract. You cannot change it and every reader in the same instant, because a schema change and an app deploy land at different moments and a rollout takes time. Rename the column in one step and every server still on the old code asks for a name that is gone. Rolling the app back does not help: the old code is exactly what needs the old column. The safe route is three separate changes. Expand: add the new shape beside the old and write both. Migrate: copy existing data across and move readers over, one at a time. Contract: remove the old shape only after a check shows nothing still reads it. Each step is small and can be undone on its own.

How this comes up in interviews

"You need to rename a database column that several services read, with no downtime. Walk me through it."

Then they ask

  1. How do you know it is safe to drop the old column, given readers you may not know about?
  2. While both columns are written, how do you backfill old rows without overwriting newer values?
  3. At which point does the migration stop being reversible, and how do you guard that step?

A strong answer covers

  • A schema change and an app deploy land at different moments, so a one-step rename breaks every server still on the old code.
  • Rolling the app back does not help, because the old code is exactly what needs the old column.
  • Expand: add the new column beside the old and write both. Migrate: copy existing rows across, then move readers one at a time.
  • Contract: remove the old shape only after measured reads of it have been zero for long enough to cover rare jobs.
  • Each step is small and can be undone alone. The drop cannot be undone by redeploying, so give it its own gate.

Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.

On one page: the track cheat sheet.

Last reviewed: Engineering write-up

Diagrams are our own simulations: the timings, rates and counts in them are illustrative, not measurements. Captions are original wording.