chia7712 commented on a change in pull request #11128:
URL: https://github.com/apache/kafka/pull/11128#discussion_r676262149



##########
File path: 
clients/src/main/java/org/apache/kafka/common/requests/MetadataResponse.java
##########
@@ -100,10 +100,7 @@ public int throttleTimeMs() {
     @Override
     public Map<Errors, Integer> errorCounts() {
         Map<Errors, Integer> errorCounts = new HashMap<>();
-        data.topics().forEach(metadata -> {
-            metadata.partitions().forEach(p -> updateErrorCounts(errorCounts, 
Errors.forCode(p.errorCode())));

Review comment:
       According to 
https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/server/metadata/ZkMetadataCache.scala#L103,
 it is possible that partition-level has error but topic-level gets none. 
Hence, it produces inaccurate count of "error" if we remove this line.
   
   If we want to make correct count of `error` and `none`, we have to add 
following check.
   
   1. if topic has error, we don't need to loop partitions.
   2. if topic has no error, we have to loop partitions.
   
   @ijuma WDYT? 




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to