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


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -2759,11 +2761,20 @@ class ReplicaManager(val config: KafkaConfig,
                                           delta: TopicsDelta,
                                           topicId: Uuid): Option[(Partition, 
Boolean)] = {
     getPartition(tp) match {
-      case HostedPartition.Offline =>
-        stateChangeLogger.warn(s"Unable to bring up new local leader $tp " +
-          s"with topic id $topicId because it resides in an offline log " +
-          "directory.")
-        None
+      case HostedPartition.Offline(offlinePartition) =>
+        if (offlinePartition.flatMap(p => p.topicId).contains(topicId)) {
+          stateChangeLogger.warn(s"Unable to bring up new local leader $tp " +
+            s"with topic id $topicId because it resides in an offline log " +
+            "directory.")
+          None
+        } else {
+          stateChangeLogger.info(s"Creating new partition $tp with topic id " 
+ s"$topicId." +
+            s"A topic with the same name but different id exists but it 
resides in an offline log " +
+            s"directory.")

Review Comment:
   Question: From this check `if (offlinePartition.flatMap(p => 
p.topicId).contains(topicId))`, we can make sure this partition is not in an 
offline dir, but how could we know if the partition is an Online dir, or an 
None dir, or even in another offline dir? Should we use topicIDPartition as the 
key for `allPartitions`?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to