soarez commented on code in PR #15335: URL: https://github.com/apache/kafka/pull/15335#discussion_r1518545295
########## core/src/main/scala/kafka/log/LogManager.scala: ########## @@ -355,10 +355,11 @@ class LogManager(logDirs: Seq[File], } else if (logDir.getName.endsWith(UnifiedLog.StrayDirSuffix)) { addStrayLog(topicPartition, log) warn(s"Loaded stray log: $logDir") - } else if (shouldBeStrayKraftLog(log)) { - // Mark the partition directories we're not supposed to have as stray. We have to do this - // during log load because topics may have been recreated with the same name while a disk - // was offline. + } else if (isStray(log.topicId, topicPartition)) { + // Opposite of Zookeeper mode deleted topic in KRAFT mode can be recreated while it's not fully deleted from broker. + // As a result of this broker in KRAFT mode with one offline directory has no way to detect to-be-deleted replica in an offline directory earlier. + // However, broker need to mark the partition directories as stray during log load because topics may have been + // recreated with the same name while a log directory was offline. Review Comment: ```suggestion // Unlike Zookeeper mode, which tracks pending topic deletions under a ZNode, KRaft is unable to prevent a topic from being recreated before every replica has been deleted. // A KRaft broker with an offline directory may be unable to detect it still holds a to-be-deleted replica, and can create a conflicting topic partition for a new incarnation of the topic in one of the remaining online directories. // So upon a restart in which the offline directory is back online we need to clean up the old replica directory. ``` -- 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