dajac commented on code in PR #19611:
URL: https://github.com/apache/kafka/pull/19611#discussion_r2095270860


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/SubscribedTopicDescriberImpl.java:
##########
@@ -79,49 +81,65 @@ public int numPartitions(Uuid topicId) {
      */
     @Override
     public Set<String> racksForPartition(Uuid topicId, int partition) {
+        TopicImage topic = metadataImage.topics().getTopic(topicId);
+        if (topic != null) {
+            PartitionRegistration partitionRegistration = 
topic.partitions().get(partition);
+            if (partitionRegistration != null) {
+                Set<String> racks = new HashSet<>();
+                for (int replica : partitionRegistration.replicas) {
+                    // Only add the rack if it is available for the 
broker/replica.
+                    
metadataImage.cluster().broker(replica).rack().ifPresent(racks::add);

Review Comment:
   In KIP-881, we don't check whether replicas are online or offline. We 
basically assume that they will eventually come back. I would follow the same 
approach here.
   
   Side note, this needs to be aligned with the computation of the hash. There, 
we include all replicas regardless of whether they are online or not.



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

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

Reply via email to