Guozhang Wang created KAFKA-7985: ------------------------------------ Summary: Cleanup AssignedTasks / AbstractTask logic Key: KAFKA-7985 URL: https://issues.apache.org/jira/browse/KAFKA-7985 Project: Kafka Issue Type: Improvement Reporter: Guozhang Wang
Today the life time of a task is: created -> [initializeStateStores] -> restoring (writes to the initialized state stores) -> [initializeTopology] -> running -> [closeTopology] -> suspended -> [closeStateManager] -> dead And hence the assigned tasks contains the following non-overlapping sets : created, restoring, running, suspended, (dead tasks do no need to be maintained). Normally `created` should be empty since once a task is created it should move on transit to either restoring or running immediately. So whenever we are suspending tasks, we should go through these sets and act accordingly: 1. `created` and `suspended`: just check these two sets are always empty. 2. `running`: transit to `suspended`. 3. `restoring`: transite to `suspended`. But the difference here is that we do not need to close topology since it was not created yet at all; we just need to remember the restored position, and keep the restorers on hold instead of clearing all of them. -- This message was sent by Atlassian JIRA (v7.6.3#76005)