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


##########
storage/src/main/java/org/apache/kafka/server/log/remote/metadata/storage/TopicBasedRemoteLogMetadataManager.java:
##########
@@ -446,6 +449,20 @@ private void initializeResources() {
         }
     }
 
+    boolean isTopicExists(Admin adminClient, String topic) {

Review Comment:
   ```suggestion
       boolean doesTopicExist(Admin adminClient, String topic) {
   ```



##########
storage/src/main/java/org/apache/kafka/server/log/remote/metadata/storage/TopicBasedRemoteLogMetadataManager.java:
##########
@@ -467,30 +484,46 @@ private NewTopic createRemoteLogMetadataTopicRequest() {
         Map<String, String> topicConfigs = new HashMap<>();
         topicConfigs.put(TopicConfig.RETENTION_MS_CONFIG, 
Long.toString(rlmmConfig.metadataTopicRetentionMs()));
         topicConfigs.put(TopicConfig.CLEANUP_POLICY_CONFIG, 
TopicConfig.CLEANUP_POLICY_DELETE);
+        topicConfigs.put(TopicConfig.REMOTE_LOG_STORAGE_ENABLE_CONFIG, 
"false");
         return new NewTopic(rlmmConfig.remoteLogMetadataTopicName(),
                             rlmmConfig.metadataTopicPartitionsCount(),
                             
rlmmConfig.metadataTopicReplicationFactor()).configs(topicConfigs);
     }
 
     /**
-     * @param topic topic to be created.
+     * @param newTopic topic to be created.
      * @return Returns true if the topic already exists, or it is created 
successfully.
      */
-    private boolean createTopic(Admin adminClient, NewTopic topic) {
-        boolean topicCreated = false;
+    private boolean createTopic(Admin adminClient, NewTopic newTopic) {
+        boolean topicExists = false;
+        String topic = newTopic.name();
         try {
-            adminClient.createTopics(Collections.singleton(topic)).all().get();
-            topicCreated = true;
+            topicExists = isTopicExists(adminClient, topic);

Review Comment:
   ```suggestion
               topicExists = doesTopicExist(adminClient, topic);
   ```



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