A quorum gives you a linearizable key-value data store, not a transactional data store
Majority quorums make single-key reads and writes linearizable, but transactions still need consensus.
- Published
- Reading
- 8 min
- Tags
- #consensus#quorum#linearizability
Replicated storage forces an early decision. Does an operation need a quorum, or does it need consensus? The answer turns on the operation, not on how strong you want consistency to be.
Majority quorums can make reads and writes on a single key linearizable. They need no leader and no consensus protocol. The split comes when an operation reads a value and writes based on what it read. Compare-and-swap is one such operation. At that point a quorum cannot do the job. You need consensus, in protocols such as Paxos or Raft.
Quorums were not new in 1990. Thomas published majority consensus in 1979 [2]. Gifford published weighted voting the same year [3]. Both already required read and write quorums to overlap, and both sat inside broader database concurrency control.
That history left one question open. Processes can crash. Network messages can take any amount of time. Without locks, physical clocks, or a leader, what can majority quorums guarantee on their own? Attiya, Bar-Noy, and Dolev answered it [1]. Majority quorums give you exactly one linearizable key, called an atomic register in the paper, plus any abstraction you can build on top of such keys. The sections below set out what quorums can and cannot provide.
Quorums are good enough for a linearizable key-value store
The ABD algorithm implements an atomic register. In modern terms, that register is a single key replicated across a cluster of nodes. Linearizability means every read and write appears to happen at one instant between its start and its end.
The algorithm uses one low-level operation, communicate. A process broadcasts a message to every process and waits for replies from any majority. The algorithm never waits for a named process, so a crashed node cannot stall it [1].
- Write. The writer asks a majority for the highest timestamp it holds. The writer picks a higher timestamp, broadcasts the new value with that timestamp to all nodes, and finishes once a majority confirms the update.
- Read, phase 1. The reader queries all nodes for their current value and timestamp. The reader waits for replies from a majority and picks the value with the highest timestamp.
- Read, phase 2 (write-back). The reader broadcasts the value from phase 1 back to all nodes. The reader returns the value only after a majority confirms it.
The paper states the second phase plainly:
Before finishing the read operation, the reader announces the value it intends to adopt to at least a majority of the processors (again by using communicate).
The safety argument rests on one fact. Any two majorities of processes share at least one process. Phase 1 of a read therefore reaches at least one process that holds the most recent completed write.
Write-back gives the second half of the safety argument. Without write-back, a reader could find a new value from a write that had reached only some nodes and return that value. A later reader could reach a different majority, miss the partial write, and return an older value. Time would appear to run backward, and linearizability would fail. Write-back fixes this. Once any reader returns a value, that value already sits on a full majority.
What counts
Three counts describe a quorum.
| Symbol | What it counts |
|---|---|
| The total number of replicas that hold the key. | |
| The number of replicas that must confirm a write before the write counts as done. | |
| The number of replicas that must reply to a read before the read can use the replies. |
The rule says the read count plus the write count must exceed the replica count.
Take , , and . Then . A write touches two of the three replicas, and a read touches two of the three. The two sets must share at least one replica, so the read can find the value of the last completed write. Drop both counts to 1 and the sum is , which does not exceed . The read set and the write set can then miss each other entirely.
Overlap alone still does not give linearizability. The read must also use timestamps to pick the newest value, and it must write that value back before it returns. ABD adds both steps.
The rule also assumes a fixed set of replicas. Dynamo breaks that assumption. Dynamo uses sloppy quorums and serves each request from the first healthy nodes on a preference list [4]. Different requests can reach different sets of nodes, so read and write sets may not overlap. Dynamo reads also skip write-back.
The authors state their core result as a model emulation:
Any wait-free algorithm based on atomic, single-writer multi-reader registers can be automatically emulated in message-passing systems.
The paper uses that framework to build message-passing versions of multi-writer registers, atomic snapshots, and concurrent timestamping systems. It also builds randomized consensus algorithms with polynomial overhead in the node count [1].
The model has a cost. A majority of processes must stay reachable and free of faults. A system of nodes tolerates crash faults when . A process cut off from the majority stalls. It never returns a wrong result [1]:
Such a processor will not be able to terminate its operation but will never produce erroneous results.
Quorums are not enough
Herlihy classified shared objects by consensus number. The consensus number is the largest number of processes that can reach wait-free consensus with only that object type [5]. Read and write registers have a consensus number of 1. They cannot solve consensus even for two processes.
Read-modify-write operations sit at the other end. Compare-and-swap has a consensus number of . One atomic compare-and-swap on a shared register lets any number of processes reach agreement.
The limit follows from those two facts. A quorum algorithm builds only on read and write registers. If such an algorithm could build compare-and-swap, it would solve consensus with read and write registers alone. Herlihy proved that result impossible [5]. No quorum-only method can therefore give you conditional writes, atomic increments, multi-key transactions, or conditional inserts.
| Operation | Minimum mechanism | Example |
|---|---|---|
| Read and write a single key | Majority quorum with read write-back | ABD [1] |
| Read-modify-write (compare-and-swap) on a single key | Consensus | Cassandra IF conditions (powered by Paxos) [8] |
| Multi-key transactions | Consensus | Paxos [6], Raft [7] |
| Read and write with sloppy | Not linearizable | Dynamo [4] |
“Minimum mechanism” means the simplest construction that guarantees linearizability with crash faults and arbitrary network delay. “Consensus” means a state-machine replication protocol such as Paxos or Raft. Such a protocol makes all non-faulty nodes agree on one sequence of state changes. A single-key read-modify-write needs consensus for the same reason a multi-key transaction does. Both make a write depend on state that a read saw first.
Cassandra’s documentation warns about the cost of that step. Conditional writes “will incur a non-negligible performance cost, because Paxos is used, so this should be used sparingly” [8].
One test picks the mechanism
Ask one question about the write. Does the write depend on the value stored now? If every write blindly replaces the stored value, a quorum-backed store gives you linearizability at the lower cost. If a write must check or change the stored value before it commits, the write is a read-modify-write. That write needs consensus.
Blind overwrites fit quorums:
- User preferences. A user sets a locale to French. The write replaces the old setting without reading it. Later reads return French.
- Session management. Login writes
session/<token>with its metadata, and each request reads that key. Logout deletes the key. Each key has a single writer, and no write reads the old value. - Feature flags and configuration. An administrator sets
checkout.new_flow = on. The new value does not depend on the old one. Once the write is visible, later reads return it. - Service discovery and heartbeats. Each node writes its status and a
last_seentimestamp to its own key. Every write replaces the one before it.
State-dependent writes need consensus:
- Username registration. Two users try to register
aliceat the same time. Both reads say the name is free, and both writes then proceed. Without consensus, the system creates two accounts with one name. - Inventory reservation. One seat remains, so
seats = 1. Two checkouts readseats = 1and then writeseats = 0. The system sells the seat twice. - Financial transfers. A transfer debits one account and credits another. Both updates must commit together or not at all. The debit must also check the balance first.
Each state-dependent case has the same shape. The code reads, then writes. On a quorum store, the read and the write run as two separate linearizable operations. Another write can land between them.
Send state-dependent writes to consensus. Keep blind reads and overwrites on quorums. Pay for consensus only where a write depends on a read.
References
- Attiya, Bar-Noy, Dolev. Sharing Memory Robustly in Message-Passing Systems. PODC 1990.
- Thomas. A Majority Consensus Approach to Concurrency Control for Multiple Copy Databases. ACM TODS 1979.
- Gifford. Weighted Voting for Replicated Data. SOSP 1979.
- DeCandia et al. Dynamo: Amazon’s Highly Available Key-value Store. SOSP 2007.
- Herlihy. Wait-Free Synchronization. ACM TOPLAS 1991.
- Lamport. The Part-Time Parliament. ACM TOCS 1998.
- Ongaro, Ousterhout. In Search of an Understandable Consensus Algorithm. USENIX ATC 2014.
- Apache Cassandra. Data Manipulation. Cassandra CQL documentation.
Arun Lakshman Ravichandran