nerdexam
Confluent

CCDAK · Question #121

A client connects to a broker in the cluster and sends a fetch request for a partition in a topic. It gets an exception Not Leader For Partition Exception in the response. How does client handle…

The correct answer is B. Send metadata request to the same broker for the topic and select the broker hosting the leader. In case the consumer has the wrong leader of a partition, it will issue a metadata request. The Metadata request can be handled by any node, so clients know afterwards which broker are the designated leader for the topic partitions. Produce and consume requests can only be sent…

Kafka Client Fundamentals

Question

A client connects to a broker in the cluster and sends a fetch request for a partition in a topic. It gets an exception Not Leader For Partition Exception in the response. How does client handle this situation?

Options

  • AGet the Broker id from Zookeeper that is hosting the leader replica and send request to it
  • BSend metadata request to the same broker for the topic and select the broker hosting the leader
  • CSend metadata request to Zookeeper for the topic and select the broker hosting the leader replica
  • DSend fetch request to each Broker in the cluster

How the community answered

(25 responses)
  • A
    8% (2)
  • B
    80% (20)
  • C
    8% (2)
  • D
    4% (1)

Explanation

In case the consumer has the wrong leader of a partition, it will issue a metadata request. The Metadata request can be handled by any node, so clients know afterwards which broker are the designated leader for the topic partitions. Produce and consume requests can only be sent to the node hosting partition leader.

Topics

#metadata request#partition leader#NotLeaderForPartition#client error handling

Community Discussion

No community discussion yet for this question.

Full CCDAK Practice