05 / 35 · Beyond One Machine
Consistency between nodes
State what a read can return after a write, derive quorum overlap and trace a network partition.
A payment write for order 106 has returned success. The next read goes to a different replica and says that the order is unpaid. We need a contract that says whether that history is allowed, before deciding what the replica should do.
Compare histories at the client#
An operation has a call and a response. Linearizability requires a history that can be read as a legal sequential execution, with every completed operation taking effect at a point between call and response. In particular, if one operation has finished before another starts, the sequential order must respect that precedence. If writing paid finishes before a read starts and no later write intervenes, that read must return paid. If the operations overlap, a read of the old value can be consistent with a read that took effect first. (Herlihy and Wing, §2)
Read your writes is narrower. A session sees its own successful writes in subsequent reads, even if another session can still see older data. A service can carry a session’s minimum observed version and send reads to a replica that has applied at least that version. It must wait or change the destination when the local replica is behind. Eventual convergence asks replicas to agree if writes stop and updates can be delivered and reconciled. By itself it gives no bound on how long a read can stay stale. The original Dynamo design exposes versioned values and can reconcile conflicting updates. (DeCandia et al., §§4.4–4.6)
Derive what quorum overlap gives#
For a key with fixed replicas, let be the number of acknowledgements required by a write and the number of responses required by a read. The write and read sets must share a replica when . If the sets were disjoint they would contain different replicas, which cannot fit among .
With , and , suppose A and B have applied version 1 after a write, and C still has version 0. A read from B and C receives versions 1 and 0. Selecting the newest version gives 1 in this setup. We assumed a fixed replica set, an order of versions from one writer, and no concurrent or partially completed write. With and , a write on A can be missed entirely by reading B and C.
Overlap gives a shared witness, while a full protocol must define write ordering, version selection, visibility and failure handling. Replacing missing replicas with different nodes can invalidate the fixed-set argument. Dynamo’s original sloppy quorum can use alternate reachable nodes with later hinted handoff, so the size inequality alone is insufficient for linearizability. A leader-based protocol also needs to confirm that a node still has authority before it answers a strong read. Raft describes checks against a majority for this purpose. (DeCandia et al., §§4.5–4.6, Ongaro and Ousterhout, §8)
Read during a network partition#
Split A from B and C. Messages between the two sides can be lost indefinitely. A reader can still reach A. Consider one history where the majority acknowledged the payment before that read, and another history where there was no payment. A has the same local evidence in both histories. To behave like a single linearizable copy it must answer paid in the first and unpaid in the second.
Both histories look the same on A
A policy can require A to establish contact with enough peers and withhold a successful read while isolated. B and C may elect a leader and continue under the protocol when they can communicate. Another policy can let A serve its local value. In the first history that answer is stale. These are different contracts during the same partition.
In the CAP result, consistency is atomic read/write behaviour, availability requires operations on non-failing nodes to complete with valid responses, and the model allows a network partition. No algorithm can always give both guarantees in that setting. A refusal or a timeout is useful feedback, but it does not give the successful read required by that availability definition. The result addresses network separation. It does not classify every product or replace the need to specify a particular operation’s semantics. (Gilbert and Lynch, §§2–3)
Next#
The contract says what the service must do when bytes live on several machines. Distributed files and object storage compares two ways to address those bytes and separate their lifetime from the workers that read them.
References#
- Maurice P. Herlihy and Jeannette M. Wing. Linearizability: A Correctness Condition for Concurrent Objects. ACM TOPLAS 12(3), 1990, §2. Histories, real-time precedence and sequential meaning.
- Seth Gilbert and Nancy Lynch. Brewer’s Conjecture and the Feasibility of Consistent, Available, Partition-Tolerant Web Services. SIGACT News 33(2), 2002, §§2–3. Definitions and the partition argument.
- Giuseppe DeCandia et al. Dynamo: Amazon’s Highly Available Key-value Store. SOSP, 2007, §§4.4–4.6. Versioning, read and write thresholds, and hinted handoff.
- Diego Ongaro and John Ousterhout. In Search of an Understandable Consensus Algorithm. USENIX ATC, 2014, extended version, §8. Client interaction and the check for current leadership.