guozhangwang commented on a change in pull request #11479: URL: https://github.com/apache/kafka/pull/11479#discussion_r750797917
########## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java ########## @@ -908,20 +908,25 @@ private void initializeAndRestorePhase() { // Check if the topology has been updated since we last checked, ie via #addNamedTopology or #removeNamedTopology private void checkForTopologyUpdates() { - if (lastSeenTopologyVersion < topologyMetadata.topologyVersion() || topologyMetadata.isEmpty()) { - lastSeenTopologyVersion = topologyMetadata.topologyVersion(); - taskManager.handleTopologyUpdates(); - + do { topologyMetadata.maybeWaitForNonEmptyTopology(() -> state); + if (lastSeenTopologyVersion < topologyMetadata.topologyVersion()) { Review comment: As for completing the `future` objects: I think it's okay to let the first future be waiting a bit more if there are consecutive operations, i.e. in the above implementation we would complete all futures that have been registered so far when we eventually get every still-alive threads to catch up with the bumped version. -- 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