W plus R greater than N — quorum overlap and read-your-writes
If write replicas (W) plus read replicas (R) exceed RF, every read intersects every write on at least one replica — that's the geometric condition for read-your-writes.
If we want to be sure a read sees the latest write, we need to count replicas — not trust LWW alone.
Scene 08
Tunable consistency — W + R > N
- Watch
- Try it
- Predict
- Capture
Three replicas hold this key. W is the number of replicas a write must reach; R is the number a read must reach. At W=ONE, R=ONE the verdict says STALE possible — the write set and the read set don't have to overlap.
Highlighted lines are the ones running in the diagram right now.
def put(key, value, W):replicas = ring.replicas_for(key) # RF nodests = now()for r in replicas:send_async(r, Write(key, value, ts))# block until W of RF acks come backacks = wait_for(replicas, count=W)if len(acks) < W:return Unavailablereturn Ack
def get(key, R):replicas = ring.replicas_for(key)for r in replicas:send_async(r, Read(key))# block until R of RF responses arriveresponses = wait_for(replicas, count=R)if len(responses) < R:return Unavailablewinner = max(responses, key=lambda x: x.ts)return winner.value
def verdict(W, R, N):# any read set of size R and any write set of# size W are subsets of the N replicas; if their# sizes sum to more than N they cannot be disjointif W + R > N:return 'strong' # at least one shared replicareturn 'stale-possible'
Where this sits in Build a wide-column store (Cassandra / DynamoDB family)
Scene 08 of 13, in the Tunable & CAP act — W+R>N for strong reads; per-request choice between A and C under partition.. Make every read overlap every write on at least one replica by sliding two knobs.
Up next. W+R>N works in steady state — but during a network partition, the cluster splits in two and not every side can reach a majority.
All 13 scenes in Build a wide-column store (Cassandra / DynamoDB family) · Every curriculum