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 2021/08/27 07:11:46 UTC

[GitHub] [pulsar] BewareMyPower commented on a change in pull request #11791: Cleanup znode data when namespace deleted

BewareMyPower commented on a change in pull request #11791:
URL: https://github.com/apache/pulsar/pull/11791#discussion_r697206324



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
##########
@@ -306,11 +308,38 @@ protected void internalDeleteNamespace(AsyncResponse asyncResponse, boolean auth
             }
 
             try {
+                final String globalPartitionedPath = path(PARTITIONED_TOPIC_PATH_ZNODE, namespaceName.toString());
+                final String managedLedgerPath = joinPath(MANAGED_LEDGER_ROOT, namespaceName.toString());
+                // check whether partitioned topics znode exist
+                if (namespaceResources().exists(globalPartitionedPath)) {
+                    deleteRecursive(namespaceResources(), globalPartitionedPath);
+                }
+
+                try {
+                    if (namespaceResources().exists(managedLedgerPath)) {
+                        pulsar().getPulsarResources().getTopicResources()
+                                .clearDomainPersistence(namespaceName).get();
+                        pulsar().getPulsarResources().getTopicResources()
+                                .clearNamespacePersistence(namespaceName).get();
+                    }
+                } catch (ExecutionException | InterruptedException e) {
+                    // warn level log here since this failure has no side effect besides left a un-used metadata

Review comment:
       @eolivelli I'm afraid we don't have utility method for `InterruptedException` now. I think we should throw `RestException` here if `e` is `InterruptedException` like https://github.com/apache/pulsar/blob/6aa44a0e7cfed161da8db35e6b50c9f3a595629e/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java#L684-L686
   
   But I also found in this method, the `InterruptedException` was just swallowed and only warn logs are printed. See https://github.com/apache/pulsar/blob/6aa44a0e7cfed161da8db35e6b50c9f3a595629e/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java#L494-L498
   
   I prefer the first way to handle `InterruptedException`, what's your opinion?




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