You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/11/03 12:28:39 UTC

[GitHub] [kafka] lucasbru commented on a diff in pull request #12795: KAFKA-14299: Initialize directly after handleAssignment

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


##########
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:
   If that is the case, especially if it takes a long time to init rocksdb, maybe it would be the be easier to initialize the state in the state updater instead?
   



##########
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:
   If that is the case, especially if it takes a long time to init rocksdb, maybe it would be easier to initialize the state in the state updater instead?
   



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