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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -204,23 +208,48 @@ protected CompletableFuture<List<String>> 
internalGetNonPersistentTopics(Policie
                 });
     }
 
-    @SuppressWarnings("unchecked")
-    protected CompletableFuture<Void> internalDeleteNamespaceAsync(boolean 
force) {
+    /**
+     * Delete the namespace and retry to resolve some topics that were not 
created successfully(in metadata)
+     * during the deletion.
+     */
+    protected @Nonnull CompletableFuture<Void> 
internalDeleteNamespaceAsync(boolean force) {
+        final CompletableFuture<Void> future = new CompletableFuture<>();
+        RetryUtil.retryAsynchronously(() -> 
internalDeleteNamespaceAsync0(force),
+                new BackoffBuilder()
+                        .setInitialTime(200, TimeUnit.MILLISECONDS)
+                        .setMandatoryStop(15, TimeUnit.SECONDS)

Review Comment:
   I don't think it is good to set a time based limit, also because a namespace 
may have thousand of topics and it may really take more that 15 seconds.
   
   we should set a value in the order of minutes (10 minutes ?)
   and we should log something at every trial, this way from the logs it will 
be clear that something is going on
   
   
   



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -204,23 +208,48 @@ protected CompletableFuture<List<String>> 
internalGetNonPersistentTopics(Policie
                 });
     }
 
-    @SuppressWarnings("unchecked")
-    protected CompletableFuture<Void> internalDeleteNamespaceAsync(boolean 
force) {
+    /**
+     * Delete the namespace and retry to resolve some topics that were not 
created successfully(in metadata)
+     * during the deletion.
+     */
+    protected @Nonnull CompletableFuture<Void> 
internalDeleteNamespaceAsync(boolean force) {
+        final CompletableFuture<Void> future = new CompletableFuture<>();
+        RetryUtil.retryAsynchronously(() -> 
internalDeleteNamespaceAsync0(force),
+                new BackoffBuilder()
+                        .setInitialTime(200, TimeUnit.MILLISECONDS)
+                        .setMandatoryStop(15, TimeUnit.SECONDS)

Review Comment:
   what happens if the user gives up waiting and then it issues again the same 
command while the backoff is still running ? Ideally everything should work 
well and the second execution should wait for the previous execution to 
complete. The expectation for the user is that when the command completes the 
namespace is deleted.
   
   



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