divijvaidya commented on code in PR #13111: URL: https://github.com/apache/kafka/pull/13111#discussion_r1073626693
########## core/src/main/scala/kafka/controller/KafkaController.scala: ########## @@ -1664,11 +1664,21 @@ class KafkaController(val config: KafkaConfig, } private def processTopicIds(topicIdAssignments: Set[TopicIdReplicaAssignment]): Unit = { - // Create topic IDs for topics missing them if we are using topic IDs + // Create topic IDs or update with locally stored topicIDs for topics missing them if we are using topic IDs // Otherwise, maintain what we have in the topicZNode val updatedTopicIdAssignments = if (config.usesTopicId) { - val (withTopicIds, withoutTopicIds) = topicIdAssignments.partition(_.topicId.isDefined) - withTopicIds ++ zkClient.setTopicIds(withoutTopicIds, controllerContext.epochZkVersion) + val (withTopicIds, withoutTopicIds, withLocalTopicIds) = topicIdAssignments.foldLeft((Set.empty[TopicIdReplicaAssignment], Set.empty[TopicIdReplicaAssignment], Set.empty[TopicIdReplicaAssignment])) { Review Comment: > I'm also wondering if there was an operation you could have done besides making singleton sets and unioning them. I chose this approach because this was the only one where we are able to 3-way partition the `topicIdAssignments` in a single iterations. All other approaches require multiple iterations. We can work on improving this and favouring readibility once we have a consensus on whether we will proceed with this change or not. -- 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