From f69849c32735a5dc7e7a2286d653c04eb246a65d Mon Sep 17 00:00:00 2001 From: Yuhao Yang Date: Tue, 10 Dec 2024 10:37:52 -0800 Subject: [PATCH] ACTIONITEM-3738: Improve the log message for the "There are no nodes in the Kafka cluster" error. (#523) * ACTIONITEM-3738: Improve the log message for the "There are no nodes in the Kafka cluster" error. * Improve error msg. * More improvements. --------- Co-authored-by: yuhayang@linkedin.com --- .../src/main/java/org/apache/kafka/clients/NetworkClient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clients/src/main/java/org/apache/kafka/clients/NetworkClient.java b/clients/src/main/java/org/apache/kafka/clients/NetworkClient.java index 673e60d3434c7..db3c283fbe643 100644 --- a/clients/src/main/java/org/apache/kafka/clients/NetworkClient.java +++ b/clients/src/main/java/org/apache/kafka/clients/NetworkClient.java @@ -888,7 +888,8 @@ public void close() { public Node leastLoadedNode(long now) { List nodes = this.metadataUpdater.fetchNodes(); if (nodes.isEmpty()) - throw new IllegalStateException("There are no nodes in the Kafka cluster"); + throw new IllegalStateException("metadataUpdater returned empty node list. " + + "The client is not able to connect to the Kafka cluster or there are no nodes in the Kafka cluster."); LeastLoadedNodeAlgorithm algo = this.leastLoadedNodeAlgorithm; if (algo == null) { throw new IllegalStateException("leastLoadedNodeAlgorithm cannot be null");