mumrah commented on code in PR #14719: URL: https://github.com/apache/kafka/pull/14719#discussion_r1395024903
########## core/src/main/scala/kafka/server/metadata/ZkMetadataCache.scala: ########## @@ -55,6 +56,64 @@ trait ZkFinalizedFeatureCache { def getFeatureOption: Option[Features] } +case class MetadataSnapshot(partitionStates: mutable.AnyRefMap[String, mutable.LongMap[UpdateMetadataPartitionState]], + topicIds: Map[String, Uuid], + controllerId: Option[CachedControllerId], + aliveBrokers: mutable.LongMap[Broker], + aliveNodes: mutable.LongMap[collection.Map[ListenerName, Node]]) { + val topicNames: Map[Uuid, String] = topicIds.map { case (topicName, topicId) => (topicId, topicName) } +} + +object ZkMetadataCache { + /** + * Create topic deletions (leader=-2) for topics that are missing in a FULL UpdateMetadataRequest coming from a + * KRaft controller during a ZK migration. + */ + def maybeInjectDeletedPartitions( + currentMetadata: MetadataSnapshot, + updateMetadataRequest: UpdateMetadataRequest + ): Seq[Uuid] = { + if (updateMetadataRequest.isKRaftController && updateMetadataRequest.updateType() == AbstractControlRequest.Type.FULL) { Review Comment: Yea, we can do without this check here. -- 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