guozhangwang commented on code in PR #12397:
URL: https://github.com/apache/kafka/pull/12397#discussion_r925892759


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StandbyTask.java:
##########
@@ -234,6 +236,43 @@ public void closeCleanAndRecycleState() {
         log.info("Closed clean and recycled state");
     }
 
+    /**
+     * Create an active task from this standby task without closing and 
re-initializing the state stores.
+     * The task should have been in suspended state when calling this function
+     *
+     * TODO: we should be able to not need the input partitions as input param 
in future but always reuse
+     *       the task's input partitions when we have fixed partitions -> 
tasks mapping
+     */
+    public StreamTask recycle(final Time time,

Review Comment:
   I re-think about this a bit, and I felt just having `recycle` in the task is 
not sufficient as a refactoring, since we'd need to still call 1) 
task.closeCleanAndRecycleState, 2) taskCreator.createXTaskFromY(), which would 
call 3) task.recycle() in order.
   
   I think it's better to extract the creators out of the `Tasks` (then also 
extract the main consumer as well since it's only needed for the creation of 
the tasks) into `TaskManager`, and merge the above steps into a single 
function. But since this PR is getting complicated enough I'd probably defer 
this to another PR.
   
   I could either revert this function or just keep it here without the test 
coverage, and then further consolidate the logic in a follow-up PR, which one 
do you prefer?



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