FrankYang0529 commented on code in PR #15616: URL: https://github.com/apache/kafka/pull/15616#discussion_r1575583127
########## core/src/test/scala/unit/kafka/server/AlterReplicaLogDirsRequestTest.scala: ########## @@ -116,6 +124,56 @@ class AlterReplicaLogDirsRequestTest extends BaseRequestTest { assertEquals(Errors.KAFKA_STORAGE_ERROR, findErrorForPartition(alterReplicaDirResponse3, new TopicPartition(topic, 2))) } + @Test + def testAlterReplicaLogDirsRequestWithRetention(): Unit = { + val partitionNum = 1 + + // Alter replica dir before topic creation + val logDir1 = new File(servers.head.config.logDirs(1)).getAbsolutePath + val partitionDirs1 = (0 until partitionNum).map(partition => new TopicPartition(topic, partition) -> logDir1).toMap + val alterReplicaLogDirsResponse1 = sendAlterReplicaLogDirsRequest(partitionDirs1) + + // The response should show error UNKNOWN_TOPIC_OR_PARTITION for all partitions + val tp = new TopicPartition(topic, 0) + assertEquals(Errors.UNKNOWN_TOPIC_OR_PARTITION, findErrorForPartition(alterReplicaLogDirsResponse1, tp)) + assertTrue(servers.head.logManager.getLog(tp).isEmpty) + + val topicProperties = new Properties() + topicProperties.put(TopicConfig.RETENTION_BYTES_CONFIG, "1024") + topicProperties.put(TopicConfig.FILE_DELETE_DELAY_MS_CONFIG, "10000") Review Comment: The default value is 1 minute. We want to trigger some files have `.deleted` suffix, but not be removed too fast, because we want to wait for dir movement happened. -- 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