~learn.
0:00 / 1:24
W05 · Consistency and coordination

A network split leaves the leader with one friend. It should quit.

transcript

You're the leader. The network splits. You can reach one other node. The right move? Stop leading. Right now.

First, why this matters. The leader freezes in a garbage collection pause. 6 seconds. At 5 seconds, the followers time out, and elect a new leader. At 6, the old one wakes up. It has no idea it was replaced. Two leaders, both writing. That's split-brain. A slow leader looks exactly like a dead one.

So a leader keeps re-confirming its support. With 5 nodes, it needs 3. After the split, it counts confirmations. Itself, plus one. Two. Two is below the quorum. So it steps down. The other 3 can reach a majority. They elect a new leader, in a higher term.

Five nodes can't split into two groups of 3. Only one side wins. And an old leader without a majority can't commit anything anyway.

But here's the trap. Holding on, because I was elected. That's exactly how split-brain happens, when the majority picks someone new.

Winning an election isn't enough. Keep proving you have a majority. Lose the majority? Stop leading. Then fencing tokens catch whatever slips through.

Full breakdown in the lecture.