Maintenance and the end of life · lesson 5 of 7
Ideas in this lesson
AMigrationmoving data or a system from one place to another
BChecksuma short fingerprint of data: if one byte changes, it changes
CCutoverthe moment users switch to the new system

Migrations

Last updated

In its fourth year, Pila outgrows its first server: thirty barangays, three years of records, and a database that's run out of room. Everything has to move to a new host and a new database, without losing a single patient's record or a morning's queue. In this lesson you'll plan a migration the way careful teams do: rehearse it, count and check everything, switch over at a quiet time, and keep a way back. Then you'll see what happened at TSB, a British bank, when a migration was done all at once before the new system was ready.

By the end of this lesson you can

  • Plan a data migration in safe, ordered steps
  • Check a migration with counts and checksums, not by eye
  • Explain why a rehearsal and a way back matter

Why systems move

A migration moves data or a whole system from one place to another. Pila's team will face several over its life:

  • A new host, because the first server is too small (this lesson).
  • A new database shape, such as splitting name into first_name and last_name.
  • A new SMS provider, when the old one closes its service.
  • The final one: Pila's data moving to the province's regional system (lesson 8.6).

Each is adaptive maintenance (lesson 8.1), and each has the same danger: the old system works, and during the move, data can be lost or changed without anyone noticing.

Plan the move

Put the steps of Pila's move to a new database in a safe order:

  1. 1 Cutover: point Pila at the new database, at 18:00 on a Saturday
  2. 2 Rehearse the whole move on a copy, and time it
  3. 3 Write down how to switch back, and test it on the copy
  4. 4 Watch the new system closely through Monday morning’s queue
  5. 5 List everything that moves: tables, files, settings, scheduled jobs
  6. 6 Compare counts and checksums of old and new
  7. 7 A month later, switch off and archive the old database
  8. 8 Freeze writes, and copy the data to the new database

Three ideas carry the plan:

  • Rehearse. Do the whole move on a copy first. It finds the surprises (a scheduled job nobody listed, a date stored in the wrong time zone) and tells you how long the real move will take.
  • Keep a way back. Until the new system has proved itself, the old one stays ready, and switching back has been tested. Changing a database's shape can be done the same way, in steps that each keep both sides working: Fowler calls it parallel change, with lesson 7.6's expand, migrate, contract.
  • Move at a quiet time. For Pila, Saturday evening: the health centres are shut until Monday.

Check it with numbers

After copying, how do you know nothing was lost? Not by opening a few records and seeing they look right. Compare numbers:

Checking Pila’s migration
CheckOldNew
Number of tickets412,806412,806
Number of phones96,14096,140
Tickets per barangay, per month360 counts360 counts, all equal
Checksum of all ticket rows, sorted9f2c…e71a9f2c…e71a
Earliest and latest ticket date3 Mar 2027 · 18 Jun 20303 Mar 2027 · 18 Jun 2030

A checksum (such as SHA-256) is a short fingerprint calculated from data: change a single character anywhere, and the fingerprint is completely different. Equal counts show nothing went missing; equal checksums show nothing changed on the way.

The counts match, but the checksums don’t. What does that suggest?

TSB, April 2018

  1. 2015 A new owner Plan
1 of 6 2015. Sabadell, a Spanish bank, buys TSB. TSB’s banking still runs on systems rented from Lloyds, its former owner. The plan: move all of TSB’s customers onto a new platform built by Sabadell’s IT company.

The review, by the law firm Slaughter and May, found that the platform was “neither stable nor complete” when the migration was approved, and that moving everyone in one weekend left no chance to learn from a smaller first group. Compare it to Pila's plan: a rehearsal that proves readiness, numbers that prove the data, a way back, and, for a big system, moving a small group first.

Which practice from this stage would most likely have limited the damage at TSB?

Spot the trap: “it looks fine”

Spot the trapJun

Saturday, 19:30. The copy has finished. Jun opens ten patient records on the new database and they look right. “It’s fine,” he says. “Let’s switch over and go home.”

What happens if…

Check what you learned

Why rehearse a migration on a copy?
What does a matching checksum show that a matching count doesn’t?
What was a big-bang migration at TSB?

Sources

Every claim on this page comes from these sources: the standard, the founding text of a method, a study, or the official record of a project, from the body that publishes it. Industry reports are labelled as such.

All sources for Simple Software Development