eolivelli commented on code in PR #16264:
URL: https://github.com/apache/pulsar/pull/16264#discussion_r908191136


##########
pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/PulsarWorkerService.java:
##########
@@ -389,7 +397,11 @@ private static Policies 
createFunctionsNamespacePolicies(String pulsarFunctionsC
 
     private void tryCreateNonPartitionedTopic(final String topic) throws 
PulsarAdminException {
         try {
-            getBrokerAdmin().topics().createNonPartitionedTopic(topic);
+            TopicName topicName = TopicName.get(topic);
+            List<String> topics = 
getBrokerAdmin().topics().getList(topicName.getNamespace());
+            if (topics.stream().noneMatch(n -> 
TopicName.get(n).equals(topicName))) {
+                getBrokerAdmin().topics().createNonPartitionedTopic(topic);
+            }
         } catch (PulsarAdminException e) {
             if (e instanceof PulsarAdminException.ConflictException) {
                 log.warn("Failed to create topic '{}': {}", topic, 
e.getMessage());

Review Comment:
   this is the only line you want to change.
   you can switch this to DEBUG



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