Data · L2Quorums and leaderless replication

Quorums and leaderless replication

In a leaderless store, you choose how many copies must answer each read and write. Learn what that number buys you, and the cases where it still returns the wrong data.

L2 SeniorData21 min read
Fact-checked by AI against cited sources · Human review pendingLast reviewed 10 Nov 2026 · How we check content
Section 1 of 8

What broke

On 29 July 2019, at about 13:10, some Monzo customers could not log in. Some could not send or receive payments. Some saw wrong balances. 1

Monzo kept its data in one Cassandra cluster of 21 servers. Every piece of data had 3 copies. Every read and write used quorum, so at least 2 of the 3 copies had to answer. 1

That day, the team added 6 servers for more capacity. A setting, auto_bootstrap, was false. The team believed the new servers would wait, inactive, until data was copied to them. Instead, they took ownership of some keys at once and started answering queries. They held none of the data. 1

For some keys, two or three of the three copies now lived on empty servers. A quorum read could then get both of its answers from empty servers. To the app, the data looked missing. 1

Monzo had tested the change, but with one new server, not six. With one empty server, the other two copies still formed a quorum. In their words, "What we failed to account for was quorum". 1 Most customers were working again by 15:08, after the team removed the new servers one by one. All were fixed by 23:00. 1

Section 2 of 8

The idea in simple words

In replication you met the leader model, and leaderless replication in one paragraph. Here is the full picture.

In a leaderless store, there is no single node that orders writes. Each key lives on N nodes. A coordinator node sends every write to all N copies and waits for W of them to say yes. A read waits for R answers. Cassandra keeps the one with the newest timestamp. Dynamo can return several versions (more below). 2 3

If W + R > N, the copies you read and the copies you wrote must share at least one node. So the read sees the write. 2 3 Amazon's common setting was N = 3, R = 2, W = 2. 2

The key idea. W + R > N only says the two sets of nodes overlap. It does not say those nodes hold the right data, or that everyone agrees on what "newest" means. A quorum is a counting rule, not a promise of linearizability.

Section 3 of 8

How it works

Step through a write, a read, and four ways a quorum still goes wrong. Use Next and Back, or the ← and → keys.

W + R > N makes read and write sets overlap, but four common gaps still return old or missing data1 · Write x=2 with W=2 of N=3A · 2B · 2C · 1✓ okC was slow and missed it. Two yeses are enough. 2 · Read with R=2: ask B and CB · 2C · 1→ 22 + 2 > 3, so B is in both sets.The newest value wins. Read repair fixes C. 3 · Sloppy quorum: A and B unreachableC · 3D · 3 (A)x=3 lands on C and on D, a stand-in for A.A read from A + B still says 2. 4 · Write x=4 times out: only A got itA · 4B · 3C · 3The client got an error. A keeps 4 anyway.Reads may show 3, then 4. 5 · New nodes own the key but are emptyA · 4E · noneF · noneA read from E + F: "not found". SeniorPath
  1. Three replicas hold key x (N = 3). You write x=2 and wait for two of them (W = 2). A and B say yes, so the write counts. C was slow and still has the old value, 1.
  2. You read with R = 2 and happen to ask B and C. Because 2 + 2 is more than 3, at least one of them must have the write. B has 2, which is newer, so you get 2. The coordinator also sends 2 to C. That is read repair.
  3. Now the network cuts the coordinator off from A and B. A Dynamo-style sloppy quorum writes x=3 to the first healthy nodes on the list. C and stand-in D answer first; D's copy carries a hint that it belongs to A. Two yeses, so it counts. But a reader who can reach only A and B gets 2.
  4. Later, hints and repair bring A, B and C to 3. Then a write of x=4 reaches only A before the timeout. The client gets an error, but A keeps 4. Nothing rolls it back. A later read that asks A may return 4, so the failed write can still appear.
  5. Last, two new nodes, E and F, join and take ownership of key x before any data is copied to them. The quorum is now two empty nodes. The math still holds, but the answer is wrong. Monzo's 2019 outage put some keys in this state.
Step 1 of 5

Why not a strict quorum?

Dynamo was built so that a shopping cart could always take writes. 2 A strict quorum would fail writes when replicas are down or cut off. So Dynamo uses a sloppy quorum. It writes to the first N healthy nodes it can reach, even if they are not the key's usual home. 2

A stand-in node keeps the copy with a hint that names the real owner. When the owner comes back, the stand-in sends the copy over. This is hinted handoff. 2 The cost is clear from the diagram: a reader that reaches only the usual owners can miss the write.

Cassandra also stores hints for a replica that is down, for up to 3 hours by default. Its docs say hints are best effort, not a guarantee. 4 Its weakest write level, ANY, accepts a stored hint in place of a replica. At every other level, only real replicas count toward the quorum. Hints just help a replica catch up later. 3

Where else quorums leak

  • A failed write may still be there. A write that reaches only one replica returns an error, but nothing rolls it back. Cassandra's docs say such a write "may be visible in one read, and then disappear" if read repair is off. 5
  • Concurrent writes. Two clients write the same key at once. Each write reaches a quorum. Someone must now pick a winner, and that rule decides what you lose.
  • Clocks. Cassandra picks the winner by timestamp: last write wins. The timestamp comes from a client clock or the coordinator's clock, so correctness depends on synced clocks. 3 Time, clocks and ordering shows how skew lets an older write win.
  • Membership changes. At Monzo, some keys had two of their three replicas on new, empty servers. The count was right, but the data looked missing. 1

Read repair

When a read finds that replicas disagree, the coordinator writes the newest value back to the stale ones. Dynamo calls this read repair. 2 Cassandra does it in the foreground by default. The client waits until the repair is done. 5

The timing matters. Blocking repair gives "monotonic quorum reads": a second quorum read will not return something older than the first. 5 But read repair only fixes keys that someone reads. Cold keys stay out of sync.

Anti-entropy with Merkle trees

For everything else, replicas compare their data in the background. This is anti-entropy repair. Comparing every key would be slow, so Dynamo uses Merkle trees. 2

A Merkle tree is a tree of hashes. Each leaf is the hash of one key's value. Each parent is the hash of its children. Two nodes swap the root hashes for a key range. If the roots match, the range is in sync. If not, they compare children and walk down only the branches that differ. 2

Cassandra does not run repair for you. You run nodetool repair. 6 Its docs suggest incremental repair every 1–3 days and a full repair every 1–3 weeks as a starting point. 6 Deletes add a hard deadline. With the default 10-day grace period, repair every node at least once every 7 days. Otherwise deleted data can come back. 6

Tunable consistency in Cassandra

Cassandra turns R and W into named consistency levels that you set per query. 3 With a replication factor of 3:

-- in cqlsh
CONSISTENCY QUORUM;   -- 2 of 3 replicas must answer
SELECT balance FROM accounts WHERE id = 42;
  • ONE: one replica answers. Fastest, and it works if any single replica is up. 3
  • QUORUM: a majority of all replicas, n/2 + 1. QUORUM for both reads and writes gives overlap. 3
  • LOCAL_QUORUM: a majority in the coordinator's data centre. Reads see the latest write made from the same data centre. 3
  • ALL: every replica must answer. ScyllaDB rates it highest in consistency and lowest in availability. 7

The write is sent to every replica at any level. The level only sets how many answers the coordinator waits for. 3 8 Waiting for more answers means waiting for a slower node. Dynamo's paper says latency is set by "the slowest of the R (or W) replicas". 2 Lower levels are faster and keep working with more nodes down. But fewer copies have confirmed the write when you hear yes, so you get weaker consistency and durability. 8

Last write wins or versions?

Last write wins keeps one value and drops the others, with no error. If two clients each read a value, change it and write it back, the write with the lower timestamp is lost. Jepsen showed acknowledged writes being lost this way. 9 Early on, Cassandra chose this for speed. Vector clocks usually need a read before each write. 9

Dynamo kept vector clocks instead. When versions are concurrent, it returns all of them and the app merges. A cart then never loses an added item, but deleted items can come back. 2 In practice this was rare. Over 24 hours, 99.94% of requests to the cart service saw exactly one version. 2

Section 4 of 8

Trade-offs

With N = 3 replicas. The failure counts are our arithmetic.

ChoiceSurvives replicas downLatencyWhat you get
W = 1, R = 1 (ONE/ONE)Yes Up to 2.Lowest. One answer each.No overlap. Reads can be stale.
W = 2, R = 2 (QUORUM/QUORUM)Yes 1.Waits for the slower of two replicas.Overlap. Still not linearizable.
W = 3, R = 1 (ALL/ONE)No for writes. A single node down blocks writes.Writes wait for the slowest replica.Overlap with fast reads.
LOCAL_QUORUM, two data centresYes A whole remote data centre.No cross-region wait.Overlap inside one data centre only. 3
Sloppy quorumYes Writes rarely fail. 2Low.Reads can miss writes held by stand-in nodes.

Simple rule: start with QUORUM or LOCAL_QUORUM for both reads and writes. Drop to ONE only for data you can afford to see stale. For a true check-and-set, use something built for consensus, like Raft.

Section 5 of 8

At work: how a senior uses this

  • Write down N, W and R for every table, and the reason. Check what your driver actually sends. Defaults differ; cqlsh uses ONE. 8
  • Treat a timeout as "unknown", not "failed". Make writes idempotent so a retry is safe.
  • Ask, "What happens if two clients write this key at once?" If the answer is "one is lost", use a version check, a merge, or a new key per change.
  • Check that repair runs, and finishes, inside the tombstone grace period. Alert when it does not. 6
  • Treat adding or removing nodes as a risky change. Rehearse it at production scale, and watch "row not found" rates while it runs. After its outage, Monzo planned alerts on sharp shifts in "row not found". 1
  • Monitor clock offset on every node. Last write wins trusts those clocks. 3
Section 6 of 8

With AI

What to ask the agent

"Here is our Cassandra data access code. For each query, list the consistency level it really uses, including driver defaults. Flag any read and write pair where W + R is not more than the replication factor."

"Write an integration test with a 3-node Cassandra cluster. Stop one node, write at QUORUM, start the node, and check that a QUORUM read returns the new value."

"This code does read-modify-write on a Cassandra column. Show me how concurrent requests can lose an update, and rewrite it to use a lightweight transaction or a new row per change."

What to check yourself

  • The consistency levels the agent quotes match your Cassandra or ScyllaDB version's docs, and your multi-region layout.
  • Retries after a timeout are safe to repeat. A timed-out write may already be stored. 5
  • A test that "proves" consistency also covers a stopped node, a slow node and two concurrent writers. One happy run proves nothing.
  • Repair is scheduled, and someone gets alerted if it fails.
  • Any claim that quorums make reads linearizable is removed. They do not.
Section 7 of 8

Check yourself

1. A key has N = 3 replicas. You write with W = 1 and read with R = 1. Does every read see the latest acknowledged write?

Show answer

No. 1 + 1 is not more than 3, so the read may ask a replica the write has not reached yet. Overlap needs W + R > N. With 1 + 1 = 2, the copy you read and the copy you wrote can be different nodes.

2. A Cassandra write at QUORUM returns a timeout error to your code. What can be true?

Show answer

One replica may have stored it, and later reads may return it. Nothing rolls back a partly applied write. Cassandra's docs say such a write can show up in a read, and with non-blocking read repair it can then disappear.

3. Your Cassandra cluster spans two data centres. You read and write at LOCAL_QUORUM. What does the Cassandra documentation promise?

Show answer

Reads see the latest write made from within the same data centre. LOCAL_QUORUM is a majority in the local data centre only. The docs call it a weaker but useful guarantee for clients that stay in one data centre.

4. Why do Dynamo and Cassandra use Merkle trees for anti-entropy repair?

Show answer

To find the ranges that differ by comparing hashes, so replicas copy only those ranges. Equal roots mean equal data. If roots differ, the nodes walk down only the branches that differ, which cuts the data sent and the disk reads.

5. Monzo tested adding one Cassandra server and saw no problem. Adding six broke reads. Why?

Show answer

With one new empty server, the other two replicas of each key still formed a quorum. With six, some keys had two or three empty replicas. Monzo's postmortem says it failed to account for quorum. With one empty replica, every quorum of two still includes a replica that has the data. With two empty replicas, a quorum can be both empty ones.

Your progress is saved only in this browser. Export it to keep it safe.

Was this clear?
Report a mistake (opens GitHub in a new tab)
Section 8 of 8

Go deeper

Show 9 sources and related lessons
  1. Monzo, “We had issues with Monzo on 29th July. Here's what happened, and what we did to fix it.” (opens in a new tab)
    A bank's postmortem. Six new Cassandra servers took over data they did not have, and data appeared to be missing.
  2. Giuseppe DeCandia et al., “Dynamo: Amazon's Highly Available Key-value Store”, SOSP 2007 (full text on All Things Distributed) (opens in a new tab)
    The paper behind leaderless stores. Sections 4.5 to 4.7 cover R, W and N, sloppy quorums, hinted handoff and Merkle trees. Section 6 gives real (N, R, W) settings.
  3. Apache Cassandra documentation: Dynamo (opens in a new tab)
    How Cassandra follows and changes Dynamo. See "Tunable Consistency" for every consistency level and "Data Versioning" for last write wins.
  4. Apache Cassandra documentation: Hints (opens in a new tab)
    How hinted handoff works in Cassandra, the 3-hour default window, and why hints are only best effort.
  5. Apache Cassandra documentation: Read repair (opens in a new tab)
    Blocking read repair, monotonic quorum reads, and how a failed write can appear and then disappear.
  6. Apache Cassandra documentation: Repair (opens in a new tab)
    Full and incremental repair with Merkle trees, and how often to run it so deleted data does not come back.
  7. ScyllaDB documentation: Consistency Levels (opens in a new tab)
    A table of each consistency level with its consistency and availability.
  8. ScyllaDB documentation: ScyllaDB Architecture - Fault Tolerance (opens in a new tab)
    Writes go to every replica; the consistency level only sets when the client hears back. Lower levels answer faster, but fewer replicas are known to hold the write when the client is told it succeeded.
  9. Kyle Kingsbury, “Jepsen: Cassandra” (2013) (opens in a new tab)
    Why last write wins can silently drop a write, and why Cassandra chose it over vector clocks.

Real incident: Monzo, 29 Jul 2019: Monzo outage: new Cassandra servers answered reads with no data

Case studies: Amazon: How Dynamo kept the shopping cart always writable

Related: Replication · CAP, PACELC and consistency models · Time, clocks and ordering · Sharding and consistent hashing · Consensus and Raft · Cassandra in depth · CRDTs and coordination avoidance (coming soon)

Before this: Replication and Sharding and consistent hashing, which explains the ring that decides where each key lives. Related: CAP, PACELC and consistency models and Time, clocks and ordering. Next: Cassandra in depth, and CRDTs and coordination avoidance.

Term

See full entry

Jump to a section

  1. 1What broke
  2. 2The idea in simple words
  3. 3How it works
  4. 4Trade-offs
  5. 5At work
  6. 6With AI
  7. 7Check yourself
  8. 8Go deeper