Apache Kafka Streaming (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)
Disaster Recovery and Split-Brain Prevention: `unclean.leader.election.enable`.
senior LevelSystem Design
In Simple Words: What happens if the partition leader crashes, and none of the remaining available replicas are in the ISR list (all followers are out of sync)?
unclean.leader.election.enable=false(Default & Safe):- Kafka refuses to elect an out-of-sync follower as leader.
- The partition remains offline (unavailable for writes and reads) until the true leader comes back online.
- Prioritizes Durability and Consistency over Availability (CP in CAP theorem).
unclean.leader.election.enable=true(Dangerous):- Kafka elects an out-of-sync replica as leader.
- Any data that was not replicated to this follower is permanently lost and truncated.
- Prioritizes Availability over Durability (AP in CAP theorem). Never use in financial or payment systems!