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


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -2396,19 +2403,23 @@ private 
CoordinatorResult<ConsumerGroupHeartbeatResponseData, CoordinatorRecord>
 
         // 2. Update the target assignment if the group epoch is larger than 
the target assignment epoch. The delta between
         // the existing and the new target assignment is persisted to the 
partition.
-        final int targetAssignmentEpoch;
-        final Assignment targetAssignment;
-
+        Optional<Assignment> updatedTargetAssignment = Optional.empty();
         if (groupEpoch > group.assignmentEpoch()) {
-            targetAssignment = updateTargetAssignment(
+            updatedTargetAssignment = maybeUpdateTargetAssignment(

Review Comment:
   I wonder whether we should go a step further here. Have you considered 
pushing all the logic into `maybeUpdateTargetAssignment`? For instance, 
`maybeUpdateTargetAssignment` could return a record(epoch, assignment) and 
handle all the conditions that we have here. Thoughts?



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