nicktelford commented on code in PR #16922:
URL: https://github.com/apache/kafka/pull/16922#discussion_r1818827733


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/ProcessorStateManager.java:
##########
@@ -314,7 +348,7 @@ void initializeStoreOffsetsFromCheckpoint(final boolean 
storeDirIsEmpty) {
     }
 
     private void maybeRegisterStoreWithChangelogReader(final String storeName) 
{
-        if (isLoggingEnabled(storeName)) {
+        if (isLoggingEnabled(storeName) && changelogReader != null) {

Review Comment:
   > This sort of thing makes me a bit nervous. At the very least, I think we 
should throw an exception if any of these methods are invoked on a 
ProcessorStateManager for an unassigned task with uninitialized fields.
   
   This is a tricky one. This method is called from `registerStore` and 
`registerStateStores`, which both need to be called for our "startup tasks" to 
initialize the stores.
   
   If we wanted to make calling this method from startup tasks an error, we'd 
need to move this conditional out into both `registerStore` and 
`registerStateStores`, or find an alternative way to conditionally call this 
method.
   
   One simple solution would be to create an "no-op" implementation of 
`ChangelogReader` that we use in our startup tasks, before replacing with a 
"real" one once they've been assigned. Would this be a better approach?



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