CCDAK practice question 2 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 consume request is sent to broker?
Full set: 150 questionsThe min.insync.replicas configuration is a broker-side setting that enforces data durability for producer requests when acks is set to all (-1). It ensures that a write is acknowledged only after it has been successfully replicated to a minimum number of in-sync replicas. This setting does not affect consumer read requests. Consumers fetch data from the partition leader. In the described scenario, with only one replica remaining, that replica will be the leader. As long as a leader is available, it will serve data to consumers, regardless of whether the min.insync.replicas count is met. Therefore, the consumer's request will be fulfilled with data from the single remaining replica.
B. An empty message will be returned: Kafka does not return an "empty message" in this failure scenario; it either returns available data from the leader or an error if the leader is unavailable.
C. NotEnoughReplicasException will be returned: This exception is thrown to a producer with acks=all when the number of available in-sync replicas is less than min.insync.replicas. It is not returned to a consumer.
D. A new leader for the partition will be elected: Leader election is a background broker process that occurs when a leader fails. While it may have happened prior to the consume request, it is not the direct result of the consumer's request itself. The direct outcome for the consumer is receiving data.
1. Confluent Documentation, Broker Configuration: The documentation for min.insync.replicas explicitly states its purpose in relation to producer acknowledgements. "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 (either NotEnoughReplicas or NotEnoughReplicasAfterAppend)." This confirms the setting's scope is limited to producers, not consumers.
Source: Confluent Documentation, "Broker Configurations for Apache Kafka", Section: min.insync.replicas.
2. Official Apache Kafka Documentation, Section 3.2 Replication: The documentation details that consumers only read from the leader. "All reads and writes go to the leader of the partition." This fundamental principle is independent of the number of followers or the min.insync.replicas setting. As long as a leader exists, it can serve reads.
Source: Apache Kafka Documentation, "3.2 Replication".
3. "Kafka: The Definitive Guide, 2nd Edition" by Gwen Shapira, Neha Narkhede, Todd Palino (O'Reilly): Chapter 4, "Kafka Producers: Writing Messages to Kafka," explains that NotEnoughReplicasException is a retriable producer error. Chapter 5, "Kafka Consumers: Reading Data from Kafka," describes how consumers fetch data from brokers without mentioning min.insync.replicas as a condition for reads.
Source: "Kafka: The Definitive Guide, 2nd Edition", Chapter 4, "Errors and Retries in Sending Data" and Chapter 5, "Creating a Kafka Consumer". (Note: While published by O'Reilly, the authors are the original creators and key engineers of Kafka at LinkedIn and Confluent, making it an authoritative source aligned with vendor documentation).
Keep practicing
Take the free CCDAK practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CCDAK practice questions
- Question 1In Avro, removing or adding a field that has a default is a __ schema evolution
- Question 3To get acknowledgement of writes to only the leader partition, we need to use the config.…
- Question 4A customer has many consumer applications that process messages from a Kafka topic. Each …
- Question 5What information isn't stored inside of Zookeeper? (select two)
- Question 6If you enable an SSL endpoint in Kafka, what feature of Kafka will be lost?
- Question 7The exactly once guarantee in the Kafka Streams is for which flow of data?
