kirktrue commented on code in PR #15585: URL: https://github.com/apache/kafka/pull/15585#discussion_r1556133511
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java: ########## @@ -1750,8 +1750,8 @@ private void subscribeInternal(Pattern pattern, Optional<ConsumerRebalanceListen throwIfNoAssignorsConfigured(); log.info("Subscribed to pattern: '{}'", pattern); subscriptions.subscribe(pattern, listener); - updatePatternSubscription(metadata.fetch()); metadata.requestUpdateForNewTopics(); + updatePatternSubscription(metadata.fetch()); Review Comment: For my understanding, why is the re-ordering necessary? ########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManager.java: ########## @@ -541,16 +541,11 @@ public ConsumerGroupHeartbeatRequestData buildRequestData() { sentFields.rebalanceTimeoutMs = rebalanceTimeoutMs; } - if (!this.subscriptions.hasPatternSubscription()) { - // SubscribedTopicNames - only sent when joining or if it has changed since the last heartbeat - TreeSet<String> subscribedTopicNames = new TreeSet<>(this.subscriptions.subscription()); - if (sendAllFields || !subscribedTopicNames.equals(sentFields.subscribedTopicNames)) { - data.setSubscribedTopicNames(new ArrayList<>(this.subscriptions.subscription())); - sentFields.subscribedTopicNames = subscribedTopicNames; - } - } else { - // SubscribedTopicRegex - only sent if it has changed since the last heartbeat - // - not supported yet + // SubscribedTopicNames - only sent if has changed since the last heartbeat + TreeSet<String> subscribedTopicNames = new TreeSet<>(this.subscriptions.subscription()); + if (sendAllFields || !subscribedTopicNames.equals(sentFields.subscribedTopicNames)) { + data.setSubscribedTopicNames(new ArrayList<>(this.subscriptions.subscription())); + sentFields.subscribedTopicNames = subscribedTopicNames; Review Comment: Nice! -- 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