CCDAK practice question 23 of 25

A topic has three replicas and you set min.insync.replicas to 2. If two out of three replicas are not available, what happens when a produce request with acks=all is sent to broker?

Full set: 150 questions
Answer options
A: NotEnoughReplicasException will be returned Correct answer
B: Produce request is honored with single in-sync replica
C: Produce request will block till one of the two unavailable partition is available again.
Correct Answer:
A. NotEnoughReplicasException will be returned
Explanation

When a producer sends a request with acks=all, the leader broker must ensure the write is replicated to all replicas in the In-Sync Replica (ISR) set. Concurrently, the broker enforces the min.insync.replicas setting before accepting the write. In this scenario, two of the three replicas are unavailable, leaving only one replica in the ISR set. Since the ISR size (1) is less than the required min.insync.replicas (2), the broker cannot satisfy the configured durability guarantee. It will immediately reject the produce request and return a NotEnoughReplicasException to the client. This mechanism prioritizes data consistency and durability over availability.

Why Incorrect

B. This would violate the durability guarantee explicitly configured by min.insync.replicas=2. The system is configured to fail the write rather than accept it with insufficient redundancy.
C. The broker does not block. It immediately rejects the request because the precondition (ISR size >= min.insync.replicas) is not met. The producer may experience a timeout, but the broker's response is an exception.

References

1. Apache Kafka Documentation, Section 5.4 Guarantees: "Note that the topic must be configured with a min.insync.replicas setting to make this durability guarantee meaningful... If a topic is configured with min.insync.replicas=2 then the producer will get an exception if it tries to send data with acks=all and there is only one replica alive."

2. Confluent Documentation, Broker Configuration min.insync.replicas: "When a producer sets acks to all (or -1), min.insync.replicas specifies the minimum number of replicas that must acknowledge a write for the write to be considered successful. If this minimum cannot be met, then the producer will raise an exception (NotEnoughReplicas or NotEnoughReplicasAfterAppend)."

3. Narkhede, N., Shapira, G., & Palino, T. (2017). Kafka: The Definitive Guide. O'Reilly Media. Chapter 4, "Reliable Data Delivery", section "Configuring for Reliability": "If the number of ISRs is lower than min.insync.replicas, the broker will stop accepting produce requests with acks=all and will return a NotEnoughReplicasException to the client."

Scroll to Top