RamanVerma commented on a change in pull request #9364: URL: https://github.com/apache/kafka/pull/9364#discussion_r511277713
########## File path: core/src/main/scala/kafka/log/LogManager.scala ########## @@ -298,26 +300,38 @@ class LogManager(logDirs: Seq[File], /** * Recover and load all logs in the given data directories */ - private def loadLogs(): Unit = { + private[log] def loadLogs(): Unit = { info(s"Loading logs from log dirs $liveLogDirs") val startMs = time.hiResClockMs() val threadPools = ArrayBuffer.empty[ExecutorService] val offlineDirs = mutable.Set.empty[(String, IOException)] - val jobs = mutable.Map.empty[File, Seq[Future[_]]] + val jobs = ArrayBuffer.empty[Seq[Future[_]]] var numTotalLogs = 0 for (dir <- liveLogDirs) { val logDirAbsolutePath = dir.getAbsolutePath + var hadCleanShutdown: Boolean = false try { val pool = Executors.newFixedThreadPool(numRecoveryThreadsPerDataDir) threadPools.append(pool) val cleanShutdownFile = new File(dir, Log.CleanShutdownFile) if (cleanShutdownFile.exists) { info(s"Skipping recovery for all logs in $logDirAbsolutePath since clean shutdown file was found") + // Cache the clean shutdown status and use that for rest of log loading workflow. Delete the CleanShutdownFile + // so that if broker crashes while loading the log, it is considered hard shutdown during the next boot up. KAFKA-10471 + try { + cleanShutdownFile.delete() + } catch { + case e: IOException => Review comment: `java.nio.file.Files` API throws `IOException` but not the one used here `java.io.File`. Will remove this exception ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org