mjsax commented on a change in pull request #8900: URL: https://github.com/apache/kafka/pull/8900#discussion_r444517746
########## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java ########## @@ -679,92 +675,166 @@ private void cleanupTask(final Task task) { void shutdown(final boolean clean) { final AtomicReference<RuntimeException> firstException = new AtomicReference<>(null); - final Set<Task> tasksToClose = new HashSet<>(); + final Set<Task> tasksToCloseDirty = new HashSet<>(); + tasksToCloseDirty.addAll(tryCloseCleanAllActiveTasks(clean, firstException)); + tasksToCloseDirty.addAll(tryCloseCleanAllStandbyTasks(clean, firstException)); + + for (final Task task : tasksToCloseDirty) { + closeTaskDirty(task); + } + + for (final Task task : activeTaskIterable()) { + executeAndMaybeSwallow( + clean, Review comment: If `tasksToCloseDirty` is not empty, should we close dirty, too, ie pass in `clean && tasksToCloseDirty.isEmpty()` ? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org