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


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -7772,11 +7772,14 @@ public CoordinatorResult<Boolean, CoordinatorRecord> 
classicGroupJoin(
                 // The empty consumer groups should be converted to classic 
groups in classicGroupJoinToClassicGroup.
                 return 
cleanupNotNeeded(classicGroupJoinToConsumerGroup((ConsumerGroup) group, 
context, request, responseFuture));
             } else if (group.type() == STREAMS && group.isEmpty()) {
-                if (!topologyCleanupHandled && ((StreamsGroup) 
group).mayHaveTopologyDescription()) {
+                if (!topologyCleanupHandled
+                    && UNKNOWN_MEMBER_ID.equals(request.memberId())
+                    && ((StreamsGroup) group).mayHaveTopologyDescription()) {
                     // A classic join converts this empty streams group to 
classic and deletes its streams
                     // metadata. If the topology-description plugin (KIP-1331) 
may still hold a topology for the
                     // group, that data would be orphaned. So change nothing 
and return TRUE. The caller deletes
                     // the topology from the plugin, then calls again with 
topologyCleanupHandled = true to convert.
+                    // A join with a known member id keeps the group, so it 
needs no cleanup.

Review Comment:
   Done. I moved the whole comment block above the `if`.
   



##########
core/src/test/scala/unit/kafka/server/ConsumerProtocolMigrationTest.scala:
##########
@@ -163,6 +163,69 @@ class ConsumerProtocolMigrationTest(cluster: 
ClusterInstance) extends GroupCoord
     testDowngradeFromEmptyConsumerToClassicGroup()
   }
 
+  @ClusterTest
+  def testClassicJoinWithKnownMemberIdToEmptyConsumerGroup(): Unit = {

Review Comment:
   Renamed it to `testClassicMemberJoinToEmptyConsumerGroupWithKnownMemberId`, 
after `testClassicMemberJoinToConsumerGroupWithDisabledMigrationPolicy`.
   



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