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/20 10:16:36 UTC

[GitHub] [kafka] HyunSangHan opened a new pull request #11418: MINOR: Write log differently according to the size of missingListenerPartitions

HyunSangHan opened a new pull request #11418:
URL: https://github.com/apache/kafka/pull/11418


   I think it may seem a little awkward when I got a log like below,
   
   ```
   1 partitions have leader brokers without a matching listener, including [...]
   ```
   
   So I divided it to 2 types:
   
   ```
   // When more than one partition (* Same as the original)
   2 partitions have leader brokers without a matching listener, including [...]
   ```
   
   ```
   // When only one partition
   1 partition has a leader broker without a matching listener, which is ...
   ```
   
   
   
   
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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



[GitHub] [kafka] HyunSangHan commented on pull request #11418: MINOR: Write log differently according to the size of missingListenerPartitions

Posted by GitBox <gi...@apache.org>.
HyunSangHan commented on pull request #11418:
URL: https://github.com/apache/kafka/pull/11418#issuecomment-1027773412


   Can someone look at this PR? :)


-- 
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



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

Posted by GitBox <gi...@apache.org>.
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



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

Posted by GitBox <gi...@apache.org>.
HyunSangHan commented on a change in pull request #11418:
URL: https://github.com/apache/kafka/pull/11418#discussion_r760666349



##########
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 think your example will be right if I fix it like below:
   
   ```diff
       String logStatement = "{} partition" + 
               (count > 1 ? "s have leader brokers" : " has a leader broker") +
               " without a matching listener, " +
   -            (count > 1 ? "which is " : "including ") + "{}";
   +            (count > 1 ? "including " : "which is ") + "{}";
   
       log.warn(logStatement,
               count, missingListenerPartitions.subList(0, Math.min(10, count)));
   ```
   
   Thank you for your suggestion. :D




-- 
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