abbccdda commented on a change in pull request #8667:
URL: https://github.com/apache/kafka/pull/8667#discussion_r425366150



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java
##########
@@ -555,28 +555,35 @@ void runLoop() {
             } catch (final TaskCorruptedException e) {
                 log.warn("Detected the states of tasks " + 
e.corruptedTaskWithChangelogs() + " are corrupted. " +
                              "Will close the task as dirty and re-create and 
bootstrap from scratch.", e);
-
-                taskManager.commit(
-                    taskManager.tasks()
-                        .values()
-                        .stream()
-                        .filter(t -> t.state() == Task.State.RUNNING || 
t.state() == Task.State.RESTORING)
-                        .filter(t -> 
!e.corruptedTaskWithChangelogs().containsKey(t.id()))
-                        .collect(Collectors.toSet())
-                );
-                taskManager.handleCorruption(e.corruptedTaskWithChangelogs());
+                try {
+                    taskManager.commit(
+                        taskManager.tasks()
+                            .values()
+                            .stream()
+                            .filter(t -> t.state() == Task.State.RUNNING || 
t.state() == Task.State.RESTORING)
+                            .filter(t -> 
!e.corruptedTaskWithChangelogs().containsKey(t.id()))
+                            .collect(Collectors.toSet())
+                    );
+                    
taskManager.handleCorruption(e.corruptedTaskWithChangelogs());
+                } catch (final TaskMigratedException taskMigrated) {
+                    handleTaskMigrated(taskMigrated);

Review comment:
       Good point, I was also thinking whether we should do the corruption 
logic no matter what. But if we hit a TaskMigrated, the 
`taskManager.handleLostAll` will wipe out all the task states dirty, which 
seems like a super-set of jobs for handleCorruption. If we failed the commit, 
maybe we should just skip the corruption logic?




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


Reply via email to