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/08 13:08:16 UTC

[GitHub] [kafka] cadonna commented on a diff in pull request #12795: KAFKA-14299: Initialize tasks in state updater

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


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdater.java:
##########
@@ -115,6 +117,7 @@ public void run() {
 
         private void runOnce() throws InterruptedException {
             performActionsOnTasks();
+            initializeTasksIfNeeded();

Review Comment:
   Why not initialize the task during `addTask()`?



##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java:
##########
@@ -1908,6 +1888,7 @@ public void shouldThrowWhenHandlingClosingTasksOnProducerCloseError() {
         expectLastCall();
         activeTaskCreator.closeAndRemoveTaskProducerIfNeeded(taskId00);
         expectLastCall().andThrow(new RuntimeException("KABOOM!"));
+        expect(activeTaskCreator.createTasks(anyObject(), anyObject())).andReturn(mkSet());

Review Comment:
   How is this related to the change?



##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdater.java:
##########
@@ -277,6 +294,9 @@ private void addTask(final Task task) {
                     }
                 }
             }
+            if (task.state() == Task.State.CREATED) {
+                tasksToInitialize.offer(task);
+            }

Review Comment:
   I would have expected that you initialize the task before any other action, i.e. as first step in this method. Before this PR, we also initialized the task before we passed it to the state updater. Are there any reasons to do it this way? 



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