bbejeck commented on a change in pull request #9237:
URL: https://github.com/apache/kafka/pull/9237#discussion_r499670799



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/processor/internals/InternalTopologyBuilder.java
##########
@@ -633,10 +633,20 @@ public final void addInternalTopic(final String topicName,
     }
 
     public final void copartitionSources(final Collection<String> sourceNodes) 
{
-        copartitionSourceGroups.add(Collections.unmodifiableSet(new 
HashSet<>(sourceNodes)));
+        copartitionSourceGroups.add(new HashSet<>(sourceNodes));
     }
 
-    public void validateCopartition() {
+    public final void maybeUpdateCopartitionSourceGroups(final String 
replacedNodeName,
+                                                         final String 
optimizedNodeName) {
+        for (final Set<String> copartitionSourceGroup : 
copartitionSourceGroups) {
+            if (copartitionSourceGroup.contains(replacedNodeName)) {
+                copartitionSourceGroup.remove(replacedNodeName);
+                copartitionSourceGroup.add(optimizedNodeName);
+            }
+        }
+    }
+
+    public synchronized void validateCopartition() {

Review comment:
       nit: I think we can remove `synchronized` here as well




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to