cadonna commented on code in PR #12795:
URL: https://github.com/apache/kafka/pull/12795#discussion_r1010735950


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java:
##########
@@ -395,8 +395,10 @@ private void createNewTasks(final Map<TaskId, 
Set<TopicPartition>> activeTasksTo
             tasks.addActiveTasks(newActiveTasks);
             tasks.addStandbyTasks(newStandbyTask);
         } else {
-            tasks.addPendingTaskToInit(newActiveTasks);
-            tasks.addPendingTaskToInit(newStandbyTask);
+            final Map<TaskId, RuntimeException> taskInitExceptions = new 
LinkedHashMap<>();
+            Stream.concat(newActiveTasks.stream(), newStandbyTask.stream())
+                    .forEach(t -> addTaskToStateUpdater(t, 
taskInitExceptions));

Review Comment:
   When I started working on the state updater I had the same thought, but then 
I learned that task initialization might take some time due to the need of 
opening RocksDB instances. `handleAssignment()` is called in the  callback 
`ConsumerPartitionAssignor#onAssignment()` which is invoked when a group member 
receives its assignment from the leader. Having such time consuming operations 
on the rebalance path is not ideal. I do not remember exactly the reason, but I 
think with cooperative rebalancing the client might miss the immediate next 
rebalance which would lead again to more rebalances.
   @ableegoldman Please keep me honest here.    



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

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

Reply via email to