WEBVTT

00:00:00.500 --> 00:00:03.091
Release three records each tool's condition.

00:00:03.991 --> 00:00:06.452
That is a new saved fact, in Shelf.

00:00:07.351 --> 00:00:10.918
Shelf's version one file is locked, so we do not touch it.

00:00:11.817 --> 00:00:15.957
We write version two beside it: the same two counts, plus condition.

00:00:16.856 --> 00:00:19.694
And version two says how to get there from version one.

00:00:20.593 --> 00:00:22.546
Every existing tool becomes good.

00:00:23.444 --> 00:00:26.686
Remember that a parent names the exact version of its children.

00:00:27.585 --> 00:00:30.306
Branches holds Shelf version one, by name.

00:00:31.205 --> 00:00:35.007
To hold version two, Branches needs a version two of its own.

00:00:35.905 --> 00:00:39.330
And the root holds Branches, so the root needs one as well.

00:00:40.228 --> 00:00:42.806
The change travels up the owning path to the root.

00:00:43.705 --> 00:00:45.502
It does not travel sideways.

00:00:46.400 --> 00:00:49.512
Members, Loans and Policy stay on version one.

00:00:50.410 --> 00:00:51.817
One line completes it.

00:00:52.715 --> 00:00:55.437
The root names the version it is willing to start from.

00:00:56.335 --> 00:00:59.981
Now this build carries two seals: the one it wants to end on,

00:01:00.241 --> 00:01:02.494
and the one it accepts as its predecessor.

00:01:03.392 --> 00:01:06.765
Without this line, the gate would turn it away, exactly as in

00:01:06.778 --> 00:01:07.663
the last lesson.

00:01:09.800 --> 00:01:11.232
The upgrade starts.

00:01:12.132 --> 00:01:15.010
The gate sees the predecessor seal and admits the build.

00:01:15.908 --> 00:01:17.341
Now the root converts.

00:01:18.239 --> 00:01:21.989
It has no data of its own to change, only children to place.

00:01:22.888 --> 00:01:26.989
Policy, Members and Loans are unchanged, so the root moves each

00:01:27.002 --> 00:01:28.304
one across as it is.

00:01:29.203 --> 00:01:30.778
Their vaults are never opened.

00:01:31.677 --> 00:01:33.044
Branches is different.

00:01:33.942 --> 00:01:35.479
The root cannot convert it.

00:01:36.377 --> 00:01:39.007
It hands Branches to Branches' own converter.

00:01:39.906 --> 00:01:42.341
Branches does the same thing one level down.

00:01:43.239 --> 00:01:47.054
For each key, it takes the shelf, hands it to Shelf's converter,

00:01:47.354 --> 00:01:49.463
and attaches the result on the same key.

00:01:50.362 --> 00:01:52.106
Only Shelf opens a shelf.

00:01:53.005 --> 00:01:55.335
It rewrites each tool with the new field.

00:01:56.234 --> 00:01:59.255
Four, one becomes four, one, good.

00:02:00.153 --> 00:02:03.083
Branch five is empty, and converts to empty.

00:02:03.981 --> 00:02:05.726
All of that was one upgrade.

00:02:06.625 --> 00:02:08.161
No call runs in the middle.

00:02:09.059 --> 00:02:12.028
Then the services are bound, and only then does the canister

00:02:12.041 --> 00:02:13.343
remember the new seal.

00:02:14.242 --> 00:02:17.523
There is no second step and no background job, so the whole

00:02:17.536 --> 00:02:19.632
conversion has to fit in one upgrade.

00:02:20.531 --> 00:02:23.070
This is where the limits from lesson one pay off.

00:02:23.968 --> 00:02:27.158
Thirty-two branches of five hundred tools is a number you can

00:02:27.171 --> 00:02:27.666
test.

00:02:29.800 --> 00:02:32.286
Run that again, with a build that goes wrong.

00:02:33.187 --> 00:02:34.437
Back on release two.

00:02:35.335 --> 00:02:38.447
The conversion completes, the new column is there, and then

00:02:38.460 --> 00:02:39.723
startup fails.

00:02:40.622 --> 00:02:43.864
The Internet Computer restores the old program and its memory

00:02:43.877 --> 00:02:44.385
together.

00:02:45.283 --> 00:02:48.591
Release two is running again with five loans and its original

00:02:48.604 --> 00:02:49.307
contract.

00:02:50.205 --> 00:02:53.942
Now release three is in, and a week of conditions has been recorded.

00:02:54.841 --> 00:02:56.651
Someone wants release two back.

00:02:57.549 --> 00:03:00.791
The canister holds version two memory and release two expects

00:03:00.804 --> 00:03:01.572
version one.

00:03:02.471 --> 00:03:03.760
The gate refuses.

00:03:04.658 --> 00:03:06.247
Release three keeps running.

00:03:07.145 --> 00:03:10.414
To bring the old lending rules back, ship a new build that keeps

00:03:10.427 --> 00:03:13.122
version two memory and the recorded conditions.

00:03:14.020 --> 00:03:16.612
Plan that recovery path before the migration.

