artemlivshits commented on code in PR #16344:
URL: https://github.com/apache/kafka/pull/16344#discussion_r1648464072
##########
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java:
##########
@@ -1176,18 +1176,25 @@ private ClusterAndWaitTime waitOnMetadata(String topic,
Integer partition, long
metadata.awaitUpdate(version, remainingWaitMs);
} catch (TimeoutException ex) {
// Rethrow with original maxWaitMs to prevent logging
exception with remainingWaitMs
- throw new TimeoutException(
- String.format("Topic %s not present in metadata after
%d ms.",
- topic, maxWaitMs));
+ final String errorMessage = String.format("Topic %s not
present in metadata after %d ms.",
+ topic, maxWaitMs);
+ if (metadata.getError(topic) != null) {
Review Comment:
I have a couple questions:
1. Looks like we're just changing the TimeoutException handling on this
codepath, but wouldn't we want to change this across the board, i.e. whenever
we generate TimeoutException we actually add the last retriable error (unless
it's a true timeout and we simply didn't get a reply)?
2. Rather than do this error state tunnelling across multiple levels,
wouldn't it be simpler to just add the root cause whenever we decide to
initially throw TimeoutException (i.e. when we get a retriable error but throw
TimeoutException instead)?
Also I'm not sure if we get an error in the metadata request if the topic is
just missing -- looks the metadata requests would be successful, just not
contain the topic.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]