mumrah commented on code in PR #14545: URL: https://github.com/apache/kafka/pull/14545#discussion_r1365646630
########## core/src/test/scala/integration/kafka/zk/ZkMigrationIntegrationTest.scala: ########## @@ -265,6 +265,96 @@ class ZkMigrationIntegrationTest { migrationState = migrationClient.releaseControllerLeadership(migrationState) } + @ClusterTemplate("zkClustersForAllMigrationVersions") + def testMigrateTopicDeletions(zkCluster: ClusterInstance): Unit = { + // Create a topic in ZK mode + var admin = zkCluster.createAdminClient() + val newTopics = new util.ArrayList[NewTopic]() + newTopics.add(new NewTopic("test-topic-1", 100, 3.toShort)) + newTopics.add(new NewTopic("test-topic-2", 100, 3.toShort)) + newTopics.add(new NewTopic("test-topic-3", 100, 3.toShort)) + val createTopicResult = admin.createTopics(newTopics) + createTopicResult.all().get(300, TimeUnit.SECONDS) + admin.close() + val zkClient = zkCluster.asInstanceOf[ZkClusterInstance].getUnderlying().zkClient + + // Bootstrap the ZK cluster ID into KRaft + val clusterId = zkCluster.clusterId() + val kraftCluster = new KafkaClusterTestKit.Builder( + new TestKitNodes.Builder(). + setBootstrapMetadataVersion(zkCluster.config().metadataVersion()). + setClusterId(Uuid.fromString(clusterId)). + setNumBrokerNodes(0). + setNumControllerNodes(1).build()) + .setConfigProp(KafkaConfig.MigrationEnabledProp, "true") + .setConfigProp(KafkaConfig.ZkConnectProp, zkCluster.asInstanceOf[ZkClusterInstance].getUnderlying.zkConnect) + .build() + try { + kraftCluster.format() + kraftCluster.startup() + val readyFuture = kraftCluster.controllers().values().asScala.head.controller.waitForReadyBrokers(3) + + // Start a delete, but don't wait for it + admin = zkCluster.createAdminClient() + admin.deleteTopics(Seq("test-topic-1", "test-topic-2", "test-topic-3").asJava) + admin.close() Review Comment: Yes, all or none of the deletions could happen before the migration starts in the test. I'll try to think of a way to make this more reproducible. -- 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