You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "cadonna (via GitHub)" <gi...@apache.org> on 2023/10/16 13:12:28 UTC

Re: [PR] MINOR: allow removing a suspended task from task registry. [kafka]

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


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/Tasks.java:
##########
@@ -240,8 +241,8 @@ public synchronized void addTask(final Task task) {
     public synchronized void removeTask(final Task taskToRemove) {
         final TaskId taskId = taskToRemove.id();
 
-        if (taskToRemove.state() != Task.State.CLOSED) {
-            throw new IllegalStateException("Attempted to remove a task that is not closed: " + taskId);
+        if (taskToRemove.state() != Task.State.CLOSED && taskToRemove.state() != State.SUSPENDED) {

Review Comment:
   I think that needs to be `RESTORING` instead of `SUSPENDED`. I assume you came to this change by looking at this code: 
   https://github.com/apache/kafka/blob/c7f730d9d9a95ce43b19a8af06e9f5be5e25609b/streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java#L511-L512
   Here the task gets resumed (i.e., `SUSPENDED` -> `RESTORING`) before it is removed from the task registry.



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