jolshan commented on code in PR #16496:
URL: https://github.com/apache/kafka/pull/16496#discussion_r1674314203


##########
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java:
##########
@@ -1201,13 +1201,26 @@ private ClusterAndWaitTime waitOnMetadata(String topic, 
Integer partition, long
             metadata.maybeThrowExceptionForTopic(topic);
             remainingWaitMs = maxWaitMs - elapsed;
             partitionsCount = cluster.partitionCountForTopic(topic);
-        } while (partitionsCount == null || (partition != null && partition >= 
partitionsCount));
+
+            if (!topicPartitionMetadataFound(partitionsCount, partition)) {
+                String expectedMetadataNotFoundMessage = partitionsCount == 
null ?
+                    String.format("Topic %s not present in metadata after %d 
ms. Retrying until %d ms elapses",
+                        topic, elapsed, maxWaitMs) :
+                    String.format("Partition %d of topic %s with partition 
count %d is not present in metadata after %d ms. Retrying until %d ms elapses",
+                        partition, topic, partitionsCount, elapsed, maxWaitMs);
+                log.info(expectedMetadataNotFoundMessage);

Review Comment:
   Right -- but this would affect every producer and not just connect. 😅 
   
   I would think that if connect was aware of this issue, they could share this 
tip for debugging.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to