Distributed consensus protocols look intimidating when read as a wall of RPC pseudocode, yet their core safety guarantee rests on a remarkably simple pigeonhole property.

Imagine a 52-node cluster split down the middle into a 32-node majority and a 20-node minority. The majority side continues committing writes; the isolated minority enters election timeouts and stalls. Why can’t the minority simply elect its own leader and keep accepting writes?

The quorum intersection invariant

Suppose a cluster has NN voting nodes, and committing any operation requires acknowledgment from a quorum of size QQ. For two independently formed quorums to be guaranteed to overlap on at least one node, we need:

2Q>N  ⟹  Q≥⌊N2⌋+12Q > N \implies Q \ge \left\lfloor \frac{N}{2} \right\rfloor + 1

More generally, in systems with asymmetric read and write quorums (QrQ_r and QwQ_w), linearizability requires:

Qr+Qw>NQ_r + Q_w > N

Because any two majority sets must intersect in at least one node, at most one leader can be elected in any given Raft term, and any future leader is guaranteed to hear from at least one node holding every previously committed log entry.

Why the minority must stall (CAP in practice)

During a clean partition, the minority cannot tell the difference between “all 32 other nodes crashed” and “my network link to the rest of the rack was cut.” Allowing the minority to accept writes anyway would create two diverging histories — classic split-brain.

Instead, Raft chooses consistency over minority availability:

def can_commit(acks: int, cluster_size: int) -> bool:
    quorum = (cluster_size // 2) + 1
    return acks >= quorum


def handle_append_entries(node, term: int, prev_idx: int, prev_term: int) -> bool:
    if term < node.current_term:
        return False
    if term > node.current_term:
        node.step_down(term)
    return node.log_matches(prev_idx, prev_term)

Healing the partition

The interesting moment happens when the network link comes back. The isolated minority nodes may have bumped their local current_term repeatedly while timing out elections. When they reconnect:

  1. Any stale leader sees a higher term and immediately steps down to follower.
  2. The cluster settles on a single leader whose log is guaranteed to be at least as up-to-date as every committed entry.
  3. Uncommitted divergent entries on minority nodes are overwritten via AppendEntries backtracking until the cluster converges cleanly.

That single intersection rule — 2Q>N2Q > N — turns an unreliable, adversarial network into a single deterministic log.