cmccabe commented on code in PR #13703:
URL: https://github.com/apache/kafka/pull/13703#discussion_r1218713351


##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -377,7 +377,19 @@ private ReplicationControlManager(
     }
 
     public void replay(TopicRecord record) {
-        topicsByName.put(record.name(), record.topicId());
+        Uuid existingUuid = topicsByName.put(record.name(), record.topicId());
+        if (existingUuid != null) {
+            // We don't currently support sending a second TopicRecord for the 
same topic name...
+            // unless, of course, there is a RemoveTopicRecord in between.
+            if (existingUuid.equals(record.topicId())) {
+                throw new RuntimeException("Found duplicate TopicRecord for " 
+ record.name() +
+                        " with topic ID " + record.topicId());

Review Comment:
   The comment says:
   ```
               // We don't currently support sending a second TopicRecord for 
the same topic name...
               // unless, of course, there is a RemoveTopicRecord in between.```
   
   which I think does cover the scenario you were thinking of (let me know if 
this makes sense)



##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -377,7 +377,19 @@ private ReplicationControlManager(
     }
 
     public void replay(TopicRecord record) {
-        topicsByName.put(record.name(), record.topicId());
+        Uuid existingUuid = topicsByName.put(record.name(), record.topicId());
+        if (existingUuid != null) {
+            // We don't currently support sending a second TopicRecord for the 
same topic name...
+            // unless, of course, there is a RemoveTopicRecord in between.
+            if (existingUuid.equals(record.topicId())) {
+                throw new RuntimeException("Found duplicate TopicRecord for " 
+ record.name() +
+                        " with topic ID " + record.topicId());

Review Comment:
   The comment says:
   ```
               // We don't currently support sending a second TopicRecord for 
the same topic name...
               // unless, of course, there is a RemoveTopicRecord in between.
   ```
   
   which I think does cover the scenario you were thinking of (let me know if 
this makes sense)



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