You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/10/21 06:42:38 UTC

[GitHub] [kafka] 3schwartz commented on a change in pull request #11418: MINOR: Write log differently according to the size of missingListenerPartitions

3schwartz commented on a change in pull request #11418:
URL: https://github.com/apache/kafka/pull/11418#discussion_r733361106



##########
File path: clients/src/main/java/org/apache/kafka/clients/NetworkClient.java
##########
@@ -1080,8 +1080,13 @@ public void handleSuccessfulResponse(RequestHeader requestHeader, long now, Meta
                 .collect(Collectors.toList());
             if (!missingListenerPartitions.isEmpty()) {
                 int count = missingListenerPartitions.size();
-                log.warn("{} partitions have leader brokers without a matching listener, including {}",
-                        count, missingListenerPartitions.subList(0, Math.min(10, count)));
+                if (count == 1) {

Review comment:
       I believe it would be easier to interprete if you avoid using the if-else block and created the log statement in one assignment using conditionals.
   
           String logStatement = "{} partition" + 
                   (count > 1 ? "s have leader brokers" : " has a leader broker") +
                   " without a matching listener, " +
                   (count > 1 ? "which is " : "including ") + "{}";
   
           log.warn(logStatement,
                   count, missingListenerPartitions.subList(0, Math.min(10, count)));
   
   




-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org