20.7 Full database states
This section describes a replicated database as a state machine whose sites hold full database states. A locally generated change produces a new full state. A state received from another site is combined with the local state by a merge operator. There are no delta operations in this model.
Sites, vector times and database states
Let S be a set of site identifiers. A vector time is a mapping v : S → ℕ. The empty vector time v∅ is defined by v∅(s) = 0 for every s ∈ S. Vector times are ordered pointwise. Their pointwise least upper bound is denoted by ↑.
Let 𝒟 be the set of full database states. Every d ∈ 𝒟 has an output vector time vout(d). Let d∅ be the initial database state, satisfying
A state of the entire system, also called a configuration, is a mapping D : S → 𝒟. Thus D(s) is the full database state held at site s. The initial configuration D∅ is defined by
State-machine transitions
There are two kinds of transition. A local-generation transition at site s replaces D(s) = d by a new full database state d′ such that
vout(d′)(s) = vout(d)(s) + 1, and
vout(d′)(r) = vout(d)(r) for every r ≠ s.
The transition directly produces the successor state d′; it does not produce a delta and does not invoke merge. Every other site retains its existing state.
A merge transition from site s to site r replaces the state at r by
Every other site retains its existing state. This single transition is sufficient to model communication. A cached state can be held at an additional site and merged into another site later; the mathematical model does not need separate send and receive events.
A configuration is reachable if it is the initial configuration or is obtained from the initial configuration by a finite sequence of local-generation and merge transitions. Properties of reachable configurations are proved by induction on the length of this transition sequence.
Happened-before relation
The transition rules induce a happened-before relation on occurrences of database states. If d′ is locally generated from d, then d precedes d′. If c = a ⊕ b is produced by a merge, then both a and b precede c. The reflexive transitive closure of these relations is denoted by ≼. On reachable states, ≼ is a partial order; d∅ is its least element.
The strict happened-before relation is defined by a ≺ b if a ≼ b and a ≠ b. A redundant merge that leaves a state unchanged therefore does not introduce a strict happened-before edge.
The output-vector-time mapping preserves the causal order:
Merge axioms
The merge operator ⊕ combines two full database states. It satisfies the following axioms on reachable states.
Causal absorption says that merging a state whose complete history is already incorporated has no effect. It is stronger than idempotence.
The state join-semilattice
Consequently each causally valid vector time v determines a unique full database state, denoted by State(v), satisfying vout(State(v)) = v.
Thus reachable full database states form a join-semilattice under ⊕. Merge is the join. A meet has not been defined and is not required by this model, so the states are not assumed to form a lattice. No delta operation is needed to state or prove these properties.