CCAAK practice question 14 of 15

You have a Kafka cluster with topics t1 and t2. In the output below, topic t2 shows Partition 1 with a leader “-1”. What is the most likely reason…

Full set: 54 questions
You have a Kafka cluster with topics t1 and t2. In the output below, topic t2 shows Partition 1 with a leader “-1”. What is the most likely reason for this? ... $ kafka-topics --zookeeper localhost:2181 --describe --topic t1 Topic:t1 PartitionCount 1 ReplicationFactor 1 Configs: Topic: t1 Partition: 0 Leader: 0 Replicas: 0 Isr: 0 $ kafka-topics --zookeeper localhost:2181 --describe --topic t2 Topic:t2 PartitionCount 2 ReplicationFactor 1 Configs: Topic: t2 Partition: 0 Leader: 0 Replicas: 0 Isr: 0 Topic: t2 Partition: 1 Leader: -1 Replicas: 1 Isr:
Answer options
A: Broker 1 failed. Correct answer
B: Leader shows “-1” while the log cleaner thread runs on Broker 1.
C: Compression has been enabled on Broker 1.
D: Broker 1 has another partition clashing with the same name.
Correct Answer:
A. Broker 1 failed.
Explanation

The output Leader: -1 for a partition signifies that there is currently no active leader. This happens when the broker that was the leader becomes unavailable, and no other in-sync replica can be elected to take its place. In this specific case, the output for Topic: t2 Partition: 1 shows Replicas: 1. This indicates that Broker 1 is the only broker assigned to hold a replica for this partition. Therefore, if Broker 1 fails or becomes unreachable, the partition has no available replicas, the controller cannot elect a new leader, and the leader ID is set to -1 to indicate its unavailability.

Why Incorrect

B. Log cleaning is a background process for compacted topics and does not cause a partition to lose its leader or become unavailable.
C. Data compression is a configuration that affects the size of messages but has no impact on broker availability or the leader election process.
D. Kafka's architecture for identifying partitions (by topic name and partition index) prevents naming clashes; this is not a recognized failure mode.

References

1. Kafka: The Definitive Guide, 2nd Edition by Narkhede, N., Shapira, G., & Palino, T. (O'Reilly Media, 2021).

Chapter 6, Reliability, "Replication" section: Explains that if a broker containing the only replica of a partition fails, that partition becomes unavailable. The controller cannot elect a new leader because no other replicas exist. This state is reflected by a leader ID of -1.

2. Apache Kafka Official Documentation, Section 8.2 Replication:

"The leader for a partition is one of the brokers... If the leader broker fails, one of the follower brokers will become the new leader." This documentation establishes the direct link between broker failure and leader re-election. In a scenario with a replication factor of 1 (Replicas: 1), the failure of the single broker means there are no followers to become the new leader.

3. Confluent Documentation, "Unbalanced Kafka Clusters":

In discussions about cluster health, a partition with no leader (-1) is a critical indicator of a problem, most commonly an offline broker that is the sole member of that partition's replica set. The documentation on monitoring and balancing frequently cites offline brokers as the cause for partitions lacking a leader.

Scroll to Top