wcarlson5 commented on a change in pull request #11479: URL: https://github.com/apache/kafka/pull/11479#discussion_r752822683
########## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/TopologyMetadata.java ########## @@ -108,6 +124,48 @@ private void unlock() { version.topologyLock.unlock(); } + public Collection<String> sourceTopologies(final String name) { + return builders.get(name).sourceTopicCollection(); + } + + public boolean needsUpdate(final String threadName) { + return threadVersions.get(threadName) < topologyVersion(); + } + + public void registerThread(final String threadName) { + threadVersions.put(threadName, 0L); + } + + public void unregisterThread(final String threadName) { + threadVersions.remove(threadName); + } + + + public boolean reachedLatestVersion(final String threadName) { + boolean rebalance = false; + try { + lock(); + final Iterator<TopologyVersionWaiters> iterator = version.activeTopologyWaiters.listIterator(); + TopologyVersionWaiters topologyVersionWaiters; + threadVersions.put(threadName, topologyVersion()); + while (iterator.hasNext()) { + topologyVersionWaiters = iterator.next(); + final long verison = topologyVersionWaiters.topologyVersion; + if (verison <= threadVersions.get(threadName)) { + if (threadVersions.values().stream().allMatch(t -> t >= verison)) { + topologyVersionWaiters.future.complete(null); + iterator.remove(); + log.info("thread {} is now on on version {}", threadName, topologyVersionWaiters.topologyVersion); + rebalance = true; Review comment: How about we just take the rebalances for now? We can improve this later -- 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