subhashiyer9 commented on code in PR #16496: URL: https://github.com/apache/kafka/pull/16496#discussion_r1673749240
########## 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: I understand that this can get a bit spammy at times, but I decided to make it a info log since making it a debug log will still require one to enable debug logs here and based on what I have seen, from a connect point of view, enabling debug logs in KafkaProducer is not one of the top things one tries and thus would still require some digging before one reaches here in troubleshooting -- 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