mjsax commented on a change in pull request #8833:
URL: https://github.com/apache/kafka/pull/8833#discussion_r438364263



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java
##########
@@ -506,19 +455,18 @@ public void update(final Set<TopicPartition> 
topicPartitions, final ProcessorTop
 
     @Override
     public void closeAndRecycleState() {
-        prepareClose(true);
-
+        suspendCleanAndPrepareCommit();
         writeCheckpointIfNeed();
 
         switch (state()) {
             case CREATED:
-            case RUNNING:
-            case RESTORING:
             case SUSPENDED:
                 stateMgr.recycle();
                 recordCollector.close();
                 break;
 
+            case RESTORING: // we should have transitioned to `SUSPENDED` 
already

Review comment:
       I see your point, but for this case, I would prefer to introduce a new 
state -- atm, `closeAndRecycleState` transits to `CLOSED` state what is the 
same as when we actually close a task -- however, the `stateMgr` would be 
closed for a proper `CLOSED` state, while for recycling the `stateMgr` is not 
closed -- so in general, the `CLOSED` state is not a "safe" state to provide 
idempotence. Thoughts?




----------------------------------------------------------------
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:
[email protected]


Reply via email to