bbejeck commented on code in PR #18856: URL: https://github.com/apache/kafka/pull/18856#discussion_r1949922287
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java: ########## @@ -2382,17 +2382,19 @@ private CoordinatorResult<StreamsGroupHeartbeatResult, CoordinatorRecord> stream private List<StreamsGroupHeartbeatResponseData.EndpointToPartitions> maybeBuildEndpointToPartitions(StreamsGroup group) { List<StreamsGroupHeartbeatResponseData.EndpointToPartitions> endpointToPartitionsList = new ArrayList<>(); - final Map<String, StreamsGroupMember> members = group.members(); - for (Map.Entry<String, StreamsGroupMember> entry : members.entrySet()) { - final String memberIdForAssignment = entry.getKey(); - final StreamsGroupMemberMetadataValue.Endpoint endpoint = members.get(memberIdForAssignment).userEndpoint(); - StreamsGroupMember groupMember = entry.getValue(); - if (endpoint != null) { - final StreamsGroupHeartbeatResponseData.Endpoint responseEndpoint = new StreamsGroupHeartbeatResponseData.Endpoint(); - responseEndpoint.setHost(endpoint.host()); - responseEndpoint.setPort(endpoint.port()); - StreamsGroupHeartbeatResponseData.EndpointToPartitions endpointToPartitions = EndpointToPartitionsManager.endpointToPartitions(groupMember, responseEndpoint, group); - endpointToPartitionsList.add(endpointToPartitions); + if (group.membersStable()) { Review Comment: Adding this was required - otherwise we could end up trying to set up the `EndpointToPartitions` when a new member assignment is not finalized. I discovered this developing the integration test - the newly added member was in a `UNRELEASED_TASKS`. I'm open to suggestions if anyone doesn't agree with my approach here. ########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/StreamsGroup.java: ########## @@ -454,6 +454,15 @@ public Map<String, StreamsGroupMember> members() { return Collections.unmodifiableMap(members); } + public boolean membersStable() { Review Comment: Added this method - explained why above -- 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