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


##########
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:
   I think the assumption is `allPartitions` only contains the TopicPartition 
key corresponding to the "latest" topic-id in case of a conflict.
   
   I agree, keying it by `TopicIdPartition` would avoid ambiguity in the long 
run. Perhaps we should take that up in a future JIRA?



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