Question 46 of 50
What happens when the Leader goes down?
Question
"What happens when the broker hosting a Partition's Leader goes down?"
What the interviewer wants to assess
Whether you know the election is automatic, comes specifically from the ISR (not from any follower), and has a real unavailability cost — it's not transparent and instantaneous.
Resposta rápida
The cluster controller detects the broker's missing heartbeat and automatically promotes a follower from the ISR to new leader for that partition — with no manual intervention. Producers and consumers get a transient error, automatically rediscover the new leader, and resume operation.
Resposta nível Sênior
The process is automatic, but neither instant nor free: during the detection (heartbeat) and election
window — typically seconds in a healthy cluster — writes and reads for that specific partition are
temporarily unavailable. The new leader is chosen only among the replicas in the ISR, never a lagging
replica, specifically to avoid losing data already confirmed to producers with acks=all. From the
application's point of view, this shows up as a brief latency spike, not a visible failure — as long as the
client's retry configuration is correct.
In-depth explanation
See "What happens when the Leader goes down" in Chapter 5.
Exemplo financeiro
If the leader broker for the partition hosting a batch of accounts' transactions goes down during a traffic peak, the cluster elects a new leader within seconds — but producers in that window may experience a momentary latency spike until the election finishes.
"Electing a new leader is instant with no noticeable impact"
There's a real unavailability window for the partition during detection and election. Latency-sensitive systems need to account for that window in their availability budget, not assume failover is transparent.
Pode vir a seguir
Likely follow-ups: "what is min.insync.replicas?" and "what is Consumer Lag?".
Related chapters