kamalcph commented on code in PR #14755:
URL: https://github.com/apache/kafka/pull/14755#discussion_r1395176822


##########
storage/src/main/java/org/apache/kafka/server/log/remote/metadata/storage/TopicBasedRemoteLogMetadataManager.java:
##########
@@ -477,20 +492,22 @@ private NewTopic createRemoteLogMetadataTopicRequest() {
      * @return Returns true if the topic already exists, or it is created 
successfully.
      */
     private boolean createTopic(Admin adminClient, NewTopic topic) {
-        boolean topicCreated = false;
+        boolean topicExists = false;
         try {
-            adminClient.createTopics(Collections.singleton(topic)).all().get();
-            topicCreated = true;
+            topicExists = isTopicExists(adminClient, topic.name());
+            if (!topicExists) {
+                
adminClient.createTopics(Collections.singleton(topic)).all().get();

Review Comment:
   Added a log. Sample log statement from test logs:
   
   ```
    [2023-11-16 10:43:22,259] INFO Topic __remote_log_metadata created. 
TopicId: 62SdJch1TzG1CTMgJLYMPQ, numPartitions: 3, replicationFactor: 2, 
config: [remote.storage.enable=false, cleanup.policy=delete, 
retention.ms=86400000, file.delete.delay.ms=1000] 
   ```



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