Browse Source

KAFKA-3691; Confusing logging during metadata update timeout

Author: Grant Henke <granthenke@gmail.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #1509 from granthenke/timeout-logging
pull/1509/merge
Grant Henke 9 years ago committed by Ismael Juma
parent
commit
47f5ae9e9c
  1. 7
      clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java

7
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java

@ -522,7 +522,12 @@ public class KafkaProducer<K, V> implements Producer<K, V> { @@ -522,7 +522,12 @@ public class KafkaProducer<K, V> implements Producer<K, V> {
log.trace("Requesting metadata update for topic {}.", topic);
int version = metadata.requestUpdate();
sender.wakeup();
metadata.awaitUpdate(version, remainingWaitMs);
try {
metadata.awaitUpdate(version, remainingWaitMs);
} catch (TimeoutException ex) {
// Rethrow with original maxWaitMs to prevent logging exception with remainingWaitMs
throw new TimeoutException("Failed to update metadata after " + maxWaitMs + " ms.");
}
long elapsed = time.milliseconds() - begin;
if (elapsed >= maxWaitMs)
throw new TimeoutException("Failed to update metadata after " + maxWaitMs + " ms.");

Loading…
Cancel
Save