awesome-everything RU
↑ Back to the climb

Distributed Systems

Leader election: free-recall review

Crux Free-recall prompts across the leader-election unit. Answer each in your own words first, then reveal the model answer and compare.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at senior altitude — in orbit
◷ 13 min

Retrieval beats re-reading. For each prompt, say or write a full answer from memory before you open the model answer — the effort of reconstructing the safety argument is what makes it stick when you are paged at 3 a.m.

Goal

Reconstruct the unit’s spine without looking back: why a single leader exists, how Raft elects one, why a lease cannot be trusted across a pause, what split-brain is, and exactly how a fencing token closes the window.

Recall before you leave
  1. 01
    Why elect a single leader at all, and what is the cost you accept in exchange?
  2. 02
    Walk through how Raft elects a leader, and why the election timeout is randomized.
  3. 03
    Explain why a lease does not, by itself, prevent two nodes from both writing as leader.
  4. 04
    Define split-brain, and name its two distinct causes from the unit.
  5. 05
    Describe the fencing-token mechanism end to end, and state the one condition without which it is worthless.
  6. 06
    Compare how ZooKeeper and etcd represent and detect lost leadership during failover.
Recap

If you could reconstruct each answer from memory you hold the unit’s spine: a single leader serializes writes but creates a single point of failure that must be re-elected safely; Raft does it with terms and randomized 150–300 ms timeouts; leadership is a renewable lease or session (etcd lease TTL, ZooKeeper ephemeral znode) whose detection window bounds failover; a lease cannot stop a paused leader from waking and writing, which is one of the two faces of split-brain (the other being a partition, handled by quorum); and only a monotonic fencing token, enforced at the resource, makes the stale write impossible. Elect for liveness, fence for safety.

Continue the climb ↑Leader election: code and log reading
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.