chia7712 commented on code in PR #22102:
URL: https://github.com/apache/kafka/pull/22102#discussion_r4006188771


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/InternalTopologyBuilder.java:
##########
@@ -621,7 +621,10 @@ public final void addStateStore(final StoreFactory 
storeFactory,
             throw new TopologyException("A different GlobalStateStore has 
already been added with the name " + storeName);
         }
 
-        stateFactories.put(storeName, storeFactory);
+        // Reuse existing compatible factory to preserve 
connectedProcessorNames (KAFKA-20464).
+        if (stateFactory == null || allowOverride) {

Review Comment:
   For example, we could leverage `putIfAbsent` to streamline the method 
`addStateStore`



##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/InternalTopologyBuilder.java:
##########
@@ -621,7 +621,10 @@ public final void addStateStore(final StoreFactory 
storeFactory,
             throw new TopologyException("A different GlobalStateStore has 
already been added with the name " + storeName);
         }
 
-        stateFactories.put(storeName, storeFactory);
+        // Reuse existing compatible factory to preserve 
connectedProcessorNames (KAFKA-20464).
+        if (stateFactory == null || allowOverride) {

Review Comment:
   Out of curiosity: it seems `allowOverride` is always `false`, so should we 
remove it to streamline the condition? 



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