showuon commented on code in PR #15230:
URL: https://github.com/apache/kafka/pull/15230#discussion_r1466280765


##########
core/src/main/scala/kafka/log/LogManager.scala:
##########
@@ -563,6 +565,18 @@ class LogManager(logDirs: Seq[File],
     startupWithConfigOverrides(defaultConfig, 
fetchTopicConfigOverrides(defaultConfig, topicNames))
   }
 
+  def deleteStrayKRaftReplicas(
+    brokerId: Int,
+    image: TopicsImage
+  ): Unit = {
+    val strayPartitions = findStrayReplicas(brokerId, image, allLogs)
+    strayPartitions.foreach(topicPartition => {
+      val log = getLog(topicPartition).get
+      log.renameDir(UnifiedLog.logStrayDirName(topicPartition), 
shouldReinitialize = true)
+      asyncDelete(topicPartition, false, false, true)

Review Comment:
   1. We should not `Reinitialize` the metadata since the stray partitions are 
unused anymore.
   2. The renameDir is already done in `asyncDelete` if `isStray` is true, 
which is what we have now. So we don't need to renameDir here.
   



-- 
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

Reply via email to