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


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -1307,17 +1305,25 @@ private 
CoordinatorResult<ConsumerGroupHeartbeatResponseData, Record> consumerGr
             }
         }
 
-        // The subscription metadata is updated in two cases:
-        // 1) The member has updated its subscriptions;
-        // 2) The refresh deadline has been reached.
+        int groupEpoch = group.groupEpoch();
+        Map<String, TopicMetadata> subscriptionMetadata = 
group.subscriptionMetadata();
         Map<String, Integer> subscribedTopicNamesMap = 
group.subscribedTopicNames();
+        SubscriptionType subscriptionType = group.subscriptionType();
+
         if (bumpGroupEpoch || group.hasMetadataExpired(currentTimeMs)) {
+            // The subscription metadata is updated in two cases:
+            // 1) The member has updated its subscriptions;
+            // 2) The refresh deadline has been reached.
             subscribedTopicNamesMap = 
group.computeSubscribedTopicNames(member, updatedMember);
             subscriptionMetadata = group.computeSubscriptionMetadata(
                 subscribedTopicNamesMap,
                 metadataImage.topics(),
                 metadataImage.cluster()
             );
+            subscriptionType = ConsumerGroup.subscriptionType(
+                subscribedTopicNamesMap,
+                group.numMembers()

Review Comment:
   Once https://github.com/apache/kafka/pull/15847 is merged, I think that we 
can easily compute the numMembers as follow:
   
   ```
   int numMembers = group.numMembers();
   if (!group.hasMember(updatedMember.memberId() && !staticMemberReplaced) {
      numMembers++;
   }
   ```
   
   If the member did not exist and we are not replacing a static member, we 
increment by one.



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