squah-confluent commented on code in PR #24381:
URL: https://github.com/apache/kafka/pull/24381#discussion_r4705552740


##########
core/src/test/scala/unit/kafka/server/ShareGroupDescribeRequestTest.scala:
##########
@@ -109,7 +109,9 @@ class ShareGroupDescribeRequestTest(cluster: 
ClusterInstance) extends GroupCoord
             .setGroupId("grp-1")
             .setGroupState(GroupState.STABLE.toString)
             .setGroupEpoch(2)
-            .setAssignmentEpoch(2)
+            // The subscribed topic does not exist, so no share partitions are 
initialized and
+            // the group stays at the initial assignment epoch.
+            .setAssignmentEpoch(1)

Review Comment:
   This is a notable change in behavior and should be called out clearly in the 
commit message. I also think it's not desirable to have a group with an 
assignment epoch lagging behind the group epoch in steady state when the topic 
doesn't exist.
   
   To resolve this, can we bump the assignment epoch directly in 
`maybeUpdateTargetAssignment` like `maybeUpdateStreamsTargetAssignment` does?



##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupMetadataManagerTest.java:
##########
@@ -5891,6 +5891,10 @@ public void testSessionTimeoutExpirationForShareMember() 
{
             )))
         ));
 
+        replayInitializedSharePartitions(context, groupId, List.of(
+            mkShareGroupStateMetadataEntry(fooTopicId, fooTopicName, 
List.of(0, 1, 2, 3, 4, 5))
+        ));

Review Comment:
   Please follow the existing conventions in test files instead of letting the 
AI invent its own.
   
   There are plenty of existing tests that replay 
`ShareGroupStatePartitionMetadataRecord`s and yet they have not been refactored 
to use `replayInitializedSharePartitions`.
   
   The same for the other helpers. They are applied inconsistently to tests and 
should be removed for now.



##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -6336,6 +6351,16 @@ public CoordinatorResult<Void, CoordinatorRecord> 
initializeShareGroupState(
             return new CoordinatorResult<>(List.of(), null);
         }
 
+        // The initialized share partitions can only be assigned once the 
records below have been
+        // replayed, so the assignor run is triggered from a timer rather than 
from here.
+        timer.schedule(
+            shareGroupTargetAssignmentAfterInitializationKey(groupId),
+            0,
+            TimeUnit.MILLISECONDS,
+            false,
+            () -> 
maybeUpdateShareGroupTargetAssignmentAfterInitialization(groupId)
+        );

Review Comment:
   As an alternative to a timer we can add a 
`ShareGroupStatePartitionMetadataInfo` parameter to 
`maybeUpdateTargetAssignment`.



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