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


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/ProcessorStateManager.java:
##########
@@ -209,7 +212,9 @@ void registerStateStores(final List<StateStore> allStores, 
final InternalProcess
         processorContext.uninitialize();
         for (final StateStore store : allStores) {
             if (stores.containsKey(store.name())) {
-                maybeRegisterStoreWithChangelogReader(store.name());
+                if (!stateUpdaterEnabled) {
+                    maybeRegisterStoreWithChangelogReader(store.name());

Review Comment:
   That is indeed confusing! When a task is recycled, the changelogs of the 
task to recycle are unregistered from the changelog reader. Then a new task is 
created and the state manager of the task to recycle is moved to the new task. 
For example, when a standby task is recycled to become an active task, its 
changelogs are unregistered from the changelog reader 
(https://github.com/apache/kafka/blob/2b2039f0ba88e210dd09031291c050cfcda7ce4a/streams/src/main/java/org/apache/kafka/streams/processor/internals/ProcessorStateManager.java#L579),
 a new active task is created, and the state manager of the standby task is 
transferred to the new active task 
(https://github.com/apache/kafka/blob/2b2039f0ba88e210dd09031291c050cfcda7ce4a/streams/src/main/java/org/apache/kafka/streams/processor/internals/ActiveTaskCreator.java#L218).
 After the recycling, the new active task is in state `CREATED` and owns a 
state manager that has all state stores registered, but has the changelogs 
unregistered in the 
 changelog reader. When the new active task is initialized, Streams tries to 
register the state stores again. That is when it reaches this code and it will 
execute the `if`-branch. That is the state store is registered but the 
changelogs aren't registered with the changelog reader.  



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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to