ableegoldman commented on a change in pull request #8833:
URL: https://github.com/apache/kafka/pull/8833#discussion_r438475853
##########
File path:
streams/src/main/java/org/apache/kafka/streams/processor/internals/StandbyTask.java
##########
@@ -151,73 +158,24 @@ public void postCommit() {
}
}
- @Override
- public void prepareCloseClean() {
- prepareClose(true);
-
- log.info("Prepared clean close");
- }
-
- @Override
- public void prepareCloseDirty() {
- prepareClose(false);
-
- log.info("Prepared dirty close");
- }
-
- /**
- * 1. commit if we are running and clean close;
- * 2. close the state manager.
- *
- * @throws TaskMigratedException all the task has been migrated
- * @throws StreamsException fatal error, should close the thread
- */
- private void prepareClose(final boolean clean) {
- switch (state()) {
- case CREATED:
- case CLOSED:
- log.trace("Skip prepare closing since state is {}", state());
- return;
-
- case RUNNING:
- if (clean) {
- stateMgr.flush();
- }
-
- break;
-
- case RESTORING:
- case SUSPENDED:
- throw new IllegalStateException("Illegal state " + state() + "
while closing standby task " + id);
-
- default:
- throw new IllegalStateException("Unknown state " + state() + "
while closing standby task " + id);
- }
- }
-
@Override
public void closeClean() {
close(true);
-
log.info("Closed clean");
}
@Override
public void closeDirty() {
close(false);
-
log.info("Closed dirty");
}
@Override
public void closeAndRecycleState() {
- prepareClose(true);
+ suspend();
+ prepareCommit();
Review comment:
Nevermind, I see that's the pattern we follow elsewhere in this PR
----------------------------------------------------------------
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]