Section 18.2.3

Figure 3: deployment flow as a state machine

Definition

A deployment flow is a diagram of the steps that carry an update from its arrival on a device to its use by the running system, typically receive, store, validate, commit and activate. Reading it as a state machine §8.33 means treating each box as a state the device can be in, each arrow as a transition caused by one named event, and each arrow label as a guard, a condition the transition requires. This reading forces every arrow labeled “success” to say which step has completed.

Where it fits

Main entry: Staging versus commit versus activation (§8.22).

The entry on staging versus commit versus activation separates three steps. Staging stores and checks a candidate, the new version, while it has no effect. Commit is one durable write, which survives a later loss of power, after which every restart uses the candidate. Activation is the moment the running system starts to use the candidate. Each state of the flow is therefore described by two facts: which version the running system uses, and which version a restart would use. The two facts change at different arrows.

In an invented trace, a device moves from version 7 to version 8. The times are positions in the order of events, not measured durations.

time event running system uses a restart would use
1 version 8 received and stored 7 7
2 version 8 validated 7 7
3 commit record §8.21 names 8 7 8
4 pointer names 8 8 8

At time 3 the device writes its commit record, the stored record that names the version a restart will load. At time 4 it publishes a pointer: in one indivisible write to RAM, it stores the address that running code reads to find the active version.

A crash cut is the state of storage at the instant power fails: every write that finished is present, and no later write is. Power failing just after the event of any row gives one crash cut. If power fails before time 3, the commit record still names version 7, so the restart loads version 7, although version 8 is stored and validated. If power fails between times 3 and 4, the restart loads version 8, although the running system never used it. Between times 3 and 4 the two right-hand columns disagree, so every claim about the flow must say which column it concerns.

All data in this entry’s examples are invented.

Limits and common mistakes

A run that follows the success path once shows that this path can work. It does not show that every state can reach a usable end state, that every crash cut recovers, which is the subject of crash consistency §8.4, or that the flow always finishes, which is a liveness property §1.12.

Atomic visibility, meaning that a reader sees the whole old version or the whole new version and never a mix, differs from durability §8.2, meaning that a finished write survives a loss of power. The pointer write gives the first, the commit write gives the second, and neither gives the other.

Diagrams often leave out failure arrows: a check that fails, storage that is full, a write cut short by power loss, or a candidate refused because it is older than the device allows, under the rule called anti-rollback §8.26. For each missing arrow, ask which state the device enters.

Some flows add a confirm step after activation, as in a commit-confirmed update §8.23: the new version runs on trial, and a restart before confirmation returns to the old version. In such a flow the promise “version 8 stays installed after any restart” takes effect only at the confirm write.

Questions answered

Where is the linearization point §8.6?

The linearization point is not one fixed arrow of the diagram: each effect that the update promises has its own point, so the promise must be named first. A linearization point is the instant at which an operation can be treated as taking effect all at once: every observer before that instant sees the old state, and every observer after it sees the new state. An update from version 7 to version 8 makes two promises.

The arrow at which reception or validation succeeds is the linearization point of neither promise, because neither the running code nor a restart behaves differently after it. In any flow, name the promise, list every crash cut and every reader that can run during the update, and find the instant that separates those that see version 7 from those that see version 8.

Related entries: Linearization point (§8.6), Crash consistency (§8.4), Commit-confirmed update (§8.23), Reachability after update (§8.35), Commit record and selector (§8.21), Durability (§8.2), Atomicity (§8.3).