Skip to content
Kafka Is Fun

Advanced6 min

Unclean Leader Election (Data Loss Demonstration)

See what unclean leader election trades: availability for the chance of losing data.

With unclean.leader.election.enable=false, the default, a partition whose ISR is empty stays unavailable until an in-sync replica returns. With it set to true, a replica that is not in the ISR can become leader, which keeps the partition available but "may result in data loss", because that replica may lack records the old leader had acknowledged.

The steps use the simulator and name the control to use. The outcomes they describe are what the simulator models; the sources below are what Apache documents.

Steps

0 of 5 steps completed

Verification

You saw the partition stay available with the option on, and unavailable with it off.

The interview angle

unclean.leader.election.enable defaults to false. Enabling it favours availability over consistency: a replica outside the ISR can lead, and records it did not have may be lost. Whether that is acceptable depends on the data.

Sources

Checked against Kafka 4.2 documentation on 11 October 2026. Draft: not yet reviewed by a Kafka specialist, and releases move on, so confirm against the current documentation before you act on it.