Partition forces a choice

During a network partition, only the side holding a majority of replicas can satisfy QUORUM; you must pick consistency (refuse the minority) or availability (accept divergence).

Previously

W+R>N gave us read-your-writes when every replica is reachable; once the network splits the cluster in two, the minority side can no longer count to a majority.

Scene 09

Partition forces a choice

  1. Watch
  2. Try it
  3. Predict
  4. Capture
mode: partitionedN0N1N2N3N4N5N6N7user-42R1R2R3side A · 5 nodes · coordinatorside B · 3 nodesPARTITION-TIME VERDICTAVAILABLE (QUORUM)2/3 ≥ 2CL=QUORUM · RF=3 · reachable 2/3CL=QUORUM — majority side reaches 2 of 3 ✓; minority side reaches 1 of 3 → Unavailable.
← network partition: cluster split, sides cannot reach each other
majority side · 2 of 3 replicas · coordinator here
minority side · only 1 of 3 replicas reachable
CAP: during a partition you must choose C or A →
What to watch for

The cluster has split. A dashed line marks the network partition: 5 nodes on side A (with the coordinator), 3 on side B. The featured key has 3 replicas — 2 on the majority side, 1 on the minority. The verdict box on the right reads off whether the cluster can serve this key under the current consistency level.

Implementation

Highlighted lines are the ones running in the diagram right now.

Coordinator.coordinator_reach
count replicas reachable from THIS side of the cut
def coordinator_reach(key):
replicas = ring.replicas_for(key) # RF nodes
reachable = []
for r in replicas:
if can_route_to(r): # ping / gossip view
reachable.append(r)
# on a partition this is sideA-only count
return reachable
Coordinator.write_under_partition
fail fast if the chosen quorum can't be formed
def write(key, value, CL):
reach = coordinator_reach(key)
needed = quorum(CL, RF)
# ONE → 1 · QUORUM → floor(RF/2)+1 · ALL → RF
if len(reach) < needed:
return Unavailable
for r in reach:
send_async(r, Write(key, value))
wait_for(reach, count=needed)
return Ack
Coordinator.quorum
the size of the smallest majority for the chosen CL
def quorum(CL, RF):
if CL == 'ONE':
return 1
if CL == 'QUORUM':
return RF // 2 + 1 # 2 when RF=3
if CL == 'ALL':
return RF # 3 when RF=3

Where this sits in Build a wide-column store (Cassandra / DynamoDB family)

Scene 09 of 13, in the Tunable & CAP act — W+R>N for strong reads; per-request choice between A and C under partition.. Split the cluster in two; one side keeps quorum, the other goes unavailable — or you accept divergence.

Up next. Partitions are dramatic; the everyday case is a single replica blipping for a few seconds — for that the cluster has a softer trick.

All 13 scenes in Build a wide-column store (Cassandra / DynamoDB family) · Every curriculum

Built with Arqly
Every scene in Build a wide-column store (Cassandra / DynamoDB family) builds on the one before it.All 13 Build a wide-column store (Cassandra / DynamoDB family) scenes