You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Copilot (via GitHub)" <gi...@apache.org> on 2026/09/02 19:39:01 UTC

Re: [PR] KAFKA-21001: Keep warm-up tasks sticky in the streams sticky assignor [kafka]

Copilot commented on code in PR #23314:
URL: https://github.com/apache/kafka/pull/23314#discussion_r3917938262


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/assignor/StickyTaskAssignor.java:
##########
@@ -163,14 +163,28 @@ private static void collectStandbyCandidates(final Map<TaskId, ArrayList<Standby
             }
         }
 
+        // prev warm-up tasks: a warm-up task is a member restoring the state of a task whose active task is being
+        // migrated to it, so for stickiness it counts as a prev standby -- the member that has already restored the
+        // state gets the task, instead of the restore work being thrown away. Its reported offset sum ranks it among
+        // the standbys, most caught-up first.
+        for (final Map.Entry<String, Set<Integer>> entry : memberAssignmentState.warmupTasks().entrySet()) {
+            final String subtopologyId = entry.getKey();
+            final Set<Integer> partitionNoSet = entry.getValue();
+            for (final int partitionNo : partitionNoSet) {
+                standbyCandidates
+                    .computeIfAbsent(new TaskId(subtopologyId, partitionNo), task -> new ArrayList<>())
+                    .add(new StandbyCandidate(member, true, reportedOffsetSum(memberAssignmentState, subtopologyId, partitionNo)));

Review Comment:
   This does not preserve the normal in-progress migration: `assignActive` first reassigns a task to its current active owner (lines 280–292) and only consults these standby candidates for tasks left over (lines 294–308). During warm-up, the source intentionally remains active while the destination holds the warm-up, so this candidate is never considered and a recomputation cancels the migration. The new test avoids that state by giving task 8 no active owner. Warm-up ownership needs to take precedence over current active ownership, with a source-active/destination-warm-up test.



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org