Current state: Under Discussion
Discussion thread: here
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Currently Kafka Producer is able to identify unavailable partitions and avoid routing messages to them, but the definition of an unavailable partitions is - the leader of the partition is not available, this may have covered most of the cases to avoid unnecessary network calls etc.
From Producer point of view, to successfully transmit a message may require certain number of acks to be responded from the cluster. When the acks of Producer is set to all, partition leader availability is not able to define if a partition is ready/available to accept requests, Producer also needs to know if there are enough in-sync replicas in the cluster.
By exposing the min.insync.replicas of each Kafka topic to Producer, we could potentially avoid exhausting the entire Producer buffer and unnecessary network calls when a partition does not have enough in-sync replicas in the cluster and new replication may take a while to complete (partition is too large).
Add one more property called minInSyncReplicas to the TopicMetadata class that located in MetadataResponse class.
Add one more field min_insync_replicas to the MetadataResponseTopic response and bump up the version.
Add one extra parameter requireMinInSyncAcks to the partition method of Partitioner, so that we are able to build a readyPartitions on top of the availablePartitions that we get from cluster.availablePartitionsForTopic(topic) and partition messages by the readyPartitions.
The KafkaApis.handleTopicMetadataRequest needs to be updated to populate min_insync_replicas to MetadataResponseTopic
Add one more parameter requireMinInSyncAcks to Partitioner.partition method so that we are able to build a readyPartitions on top of the availablePartitions that we get from cluster.availablePartitionsForTopic(topic) and partition messages by the readyPartitions. When the acks of producer is set to 0 or 1, readyPartitions is identical to the availablePartitions we get from cluster.
Compatibility, Deprecation, and Migration Plan
The new field will not be populated when new clients talk to older brokers or when old clients talk to newer brokers, so there shouldn't be any compatibility issue.