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


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StoreChangelogReader.java:
##########
@@ -479,6 +485,26 @@ public void restore(final Map<TaskId, Task> tasks) {
         }
     }
 
+    private void updateStandbyPartitions(final Map<TaskId, Task> tasks,
+        final Set<TopicPartition> restoringChangelogs) {
+        // For standby tasks in the `tasks` map, we make sure that the 
`restoreConsumer`'s state
+        // is correct.
+        if (state == ChangelogReaderState.STANDBY_UPDATING) {
+            for (final TopicPartition partition : restoringChangelogs) {
+                final ProcessorStateManager manager = 
changelogs.get(partition).stateManager;
+                final TaskId taskId = manager.taskId();
+                final Task task = tasks.get(taskId);
+                if (manager.taskType() == TaskType.STANDBY) {
+                    if (task != null) {
+                        
restoreConsumer.resume(Collections.singleton(partition));
+                    } else {
+                        
restoreConsumer.pause(Collections.singleton(partition));
+                    }

Review Comment:
   I think a better way would be to collect the partitions to resume and pause 
and then call `restoreConsumer.pause()` and `restoreConsumer.restore()` just 
once with the collections of partitions.
   



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