suzhiking commented on code in PR #24309:
URL: https://github.com/apache/kafka/pull/24309#discussion_r4670037306


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/AssignmentRefinerImpl.java:
##########
@@ -254,8 +254,9 @@ static Map<String, ProcessLoad> indexProcessLoad(
      * that no member holds as an active task, on a member that does not 
report its restore progress, see
      * {@link #unobservableStandbyToPromote}.
      *
-     * <p>A task whose target owner is {@link WarmupSupport#NOT_SUPPORTED} is 
never staged: its target owner never
-     * reports its restore progress, so no warm-up task could ever be seen to 
complete the migration.
+     * <p>A task whose target owner is {@link WarmupSupport#NOT_SUPPORTED} is 
never warmed up: its target owner never
+     * reports its restore progress, so no warm-up task could ever be seen to 
complete the migration. It is granted to
+     * the target owner at once, unless {@code keepActiveTasks} is set.

Review Comment:
   If the a task has no holder, the task would still be granted when 
`keepActiveTasks` is set:
   
https://github.com/apache/kafka/pull/24309/changes#diff-e3f7fd9688e2be6630f2e04b36ba1ab09db09282a92a65298f2148217de487bdL331
   perhaps we can change it to
   ```suggestion
        * the target owner at once, unless {@code keepActiveTasks} is set and a 
member holds the task as an active task.
   ```



##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/AssignmentRefinerImpl.java:
##########
@@ -330,10 +331,13 @@ static TaskDecisions analyzeTasks(
             // member reconciles to. Tasks that no member holds as an active 
task are placed below as usual.
             if (holder != null && keepActiveTasks) {
                 // A process can't hold a warm-up task next to the active 
task, so a move within it can't be warmed up.
+                // A target owner that never reports its restore progress 
could not be seen to finish warming up.
                 final boolean sameProcess = 
members.get(holder.memberId()).processId().equals(targetProcessId);
+                final boolean warmable = !sameProcess

Review Comment:
   From `warmingOf`:
   ```
               // The target assignment names a member the group no longer has, 
so there is nowhere to warm up and no
               // warm-up slot may be spent. The task simply stays with its 
current owner.
               return Warming.PARK;
   ```
   Warming.PARK is used for migration where target member does not exist. Since 
we changed the semantics of empty `targetProcessId`, now if a migration is 
borrowed migration where target member heartbeat version is 0, it will instead 
get identified as parked migration, and thus `assemble` will no longer add back 
standby the target member already held, so this target member would lose a 
standby copy. I think we might need a way to differentiate invalid target 
member and invalid heartbeat version case.



##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/streams/AssignmentRefinerTest.java:
##########
@@ -3024,14 +3024,37 @@ public void 
shouldNotGrantAnyMoveAwayFromAnOwnerWhenActiveTasksHaveToStay() {
                 new AssignmentRefinerImpl.StagedMigration(
                     STATEFUL_0, "memberA1", "memberA2", Optional.empty(), 
Optional.empty()),
                 new AssignmentRefinerImpl.StagedMigration(
-                    STATEFUL_1, "memberB", "memberC", Optional.of("processC"), 
Optional.empty()),
+                    STATEFUL_1, "memberB", "memberC", Optional.empty(), 
Optional.empty()),

Review Comment:
   with change to this test, the case where a task is assigned to a member in 
another process with version >= 1 is not tested, which would keep the target 
process ID. Perhaps we can move `STATEFUL_2` to an new member D under process D.



##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/AssignmentRefinerImpl.java:
##########
@@ -1364,10 +1369,10 @@ record TaskCopy(String memberId, String processId, 
TaskRole role, boolean caught
      * @param targetOwner
      *        The member the target assignment moves the task to.
      * @param targetProcessId
-     *        The process the target owner runs in, or empty if the target 
assignment names a member the group no
-     *        longer has. Empty means the migration can never be warmed up: it 
gets no warm-up task, no warm-up slot
-     *        is spent on it, and the task stays with its current owner until 
the assignor names a member that still
-     *        exists.
+     *        The process the target owner runs in, or empty if the migration 
cannot be warmed up: the target
+     *        assignment names a member the group no longer has, the task 
moves between two members of one process,
+     *        or the target owner does not report its restore progress. An 
empty process gets the migration no warm-up

Review Comment:
   Does this line miss a preposition "with"?
   ```suggestion
        *        or the target owner does not report its restore progress. An 
empty process gets the migration with no warm-up
   ```



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