As asked
Walk me through exactly what happens when a Kafka broker that holds a partition leader crashes. Who detects the failure, what mechanism picks the new leader, and what conditions can cause that election to fail or stall?
Sample answer outline
The controller broker monitors ZooKeeper (or KRaft metadata log) for broker liveness. On failure it selects the new leader from the in-sync replica set (ISR); if the ISR is empty and unclean.leader.election.enable is false, the partition goes offline. Strong answers distinguish ZooKeeper mode from KRaft and explain how controller epoch prevents split-brain.
Expect these follow-ups
- What happens if the ISR shrinks to zero replicas before the crash?
- How does KRaft change the controller election process compared to ZooKeeper mode?