lucasbru commented on code in PR #20730:
URL: https://github.com/apache/kafka/pull/20730#discussion_r2454266039


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/CurrentAssignmentBuilder.java:
##########
@@ -304,6 +304,101 @@ private static boolean 
computeAssignmentDifferenceForOneSubtopology(final String
         return hasUnreleasedTasks;
     }
 
+    /**
+     * Takes the current currentAssignment and the targetAssignment, and 
generates three
+     * collections:
+     *
+     * - the resultAssignedTasks: the tasks that are assigned in both the 
current and target
+     * assignments.
+     * - the resultTasksPendingRevocation: the tasks that are assigned in the 
current
+     * assignment but not in the target assignment.
+     * - the resultTasksPendingAssignment: the tasks that are assigned in the 
target assignment but
+     * not in the current assignment, and can be assigned currently (i.e., 
they are not owned by
+     * another member, as defined by the `isUnreleasedTask` predicate).
+     *
+     * Epoch Handling:
+     * - For tasks in resultAssignedTasks and resultTasksPendingRevocation, 
the epoch from currentAssignment is preserved.
+     * - For tasks in resultTasksPendingAssignment, the targetAssignmentEpoch 
is used.
+     */
+    private boolean computeAssignmentDifferenceWithEpoch(Map<String, 
Map<Integer, Integer>> currentAssignment,

Review Comment:
   Yeah, as I mentioned, the change for consumer groups will be cleaner. For 
streams we have the added complexity of having to track standby tasks and 
warmup tasks as well. 
   
   We could consider simplifying this code and tracking assignment epochs also 
for standby tasks and warmup tasks. I don't think there is much runtime 
overhead, so I'd be open to that. I just did not do it since it may become 
confusing that we are tracking assingment epochs for standby tasks but then 
never use them.



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