KAFKA-1884; Add logging upon metadata response errors; reviewed by Guozhang Wang

This commit is contained in:
Manikumar Reddy 2015-05-07 15:48:40 -07:00 committed by Guozhang Wang
parent 944628b0f5
commit 31dadf0242
1 changed files with 4 additions and 0 deletions

View File

@ -391,6 +391,10 @@ public class NetworkClient implements KafkaClient {
this.metadataFetchInProgress = false; this.metadataFetchInProgress = false;
MetadataResponse response = new MetadataResponse(body); MetadataResponse response = new MetadataResponse(body);
Cluster cluster = response.cluster(); Cluster cluster = response.cluster();
// check if any topics metadata failed to get updated
if (response.errors().size() > 0) {
log.warn("Error while fetching metadata with correlation id {} : {}", header.correlationId(), response.errors());
}
// don't update the cluster if there are no valid nodes...the topic we want may still be in the process of being // don't update the cluster if there are no valid nodes...the topic we want may still be in the process of being
// created which means we will get errors and no nodes until it exists // created which means we will get errors and no nodes until it exists
if (cluster.nodes().size() > 0) { if (cluster.nodes().size() > 0) {