You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/09/14 15:20:27 UTC

[GitHub] [pulsar] codelipenghui commented on a diff in pull request #17338: [fix][admin]delete namespace fail when has partitioned system topic

codelipenghui commented on code in PR #17338:
URL: https://github.com/apache/pulsar/pull/17338#discussion_r970955250


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -264,13 +265,19 @@ protected void internalDeleteNamespace(AsyncResponse asyncResponse, boolean auth
         }
 
         boolean isEmpty;
-        List<String> topics;
+        Set<String> partitionedTopicNames = new HashSet<>();
+        Set<String> topicNames = new HashSet<>();
         try {
-            topics = pulsar().getNamespaceService().getListOfPersistentTopics(namespaceName)
-                    .get(config().getMetadataStoreOperationTimeoutSeconds(), TimeUnit.SECONDS);
-            topics.addAll(getPartitionedTopicList(TopicDomain.persistent));
-            topics.addAll(getPartitionedTopicList(TopicDomain.non_persistent));
-            isEmpty = topics.isEmpty();
+            if (policies == null || CollectionUtils.isEmpty(policies.replication_clusters)){
+                partitionedTopicNames.addAll(pulsar().getNamespaceService().getListOfPersistentTopics(namespaceName)

Review Comment:
   Why we add non-partitioned topics to `partitionedTopicNames` 
   but add partitioned topics to `topicNames`



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -281,16 +288,19 @@ protected void internalDeleteNamespace(AsyncResponse asyncResponse, boolean auth
             if (log.isDebugEnabled()) {
                 log.debug("Found topics on namespace {}", namespaceName);
             }
-            boolean hasNonSystemTopic = false;
-            for (String topic : topics) {
+            for (String topic : partitionedTopicNames) {

Review Comment:
   Can we use one loop?
   It looks basically the same



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org