junrao commented on a change in pull request #10763: URL: https://github.com/apache/kafka/pull/10763#discussion_r660164974
########## File path: core/src/test/scala/unit/kafka/log/LogCleanerTest.scala ########## @@ -1472,11 +1489,30 @@ class LogCleanerTest { time.scheduler.clear() cleanedKeys = LogTestUtils.keysInLog(log) - // 3) Simulate recovery after swap file is created and old segments files are renamed + // 4) Simulate recovery after swap file is created and old segments files are renamed // to .deleted. Clean operation is resumed during recovery. log.logSegments.head.changeFileSuffixes("", Log.SwapFileSuffix) log = recoverAndCheck(config, cleanedKeys) + // add some more messages and clean the log again + while (log.numberOfSegments < 10) { + log.appendAsLeader(record(log.logEndOffset.toInt, log.logEndOffset.toInt), leaderEpoch = 0) + messageCount += 1 + } + for (k <- 1 until messageCount by 2) + offsetMap.put(key(k), Long.MaxValue) + cleaner.cleanSegments(log, log.logSegments.take(9).toSeq, offsetMap, 0L, new CleanerStats(), + new CleanedTransactionMetadata) + // clear scheduler so that async deletes don't run + time.scheduler.clear() + cleanedKeys = LogTestUtils.keysInLog(log) + + // 5) Simulate recovery after a subset of swap files are renamed to regular files and old segments files are renamed + // to .deleted. Clean operation is resumed during recovery. + log.logSegments.head.timeIndex.file.renameTo(new File(CoreUtils.replaceSuffix(log.logSegments.head.timeIndex.file.getPath, "", Log.SwapFileSuffix))) + // .changeFileSuffixes("", Log.SwapFileSuffix) Review comment: Is this still needed? -- 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