eolivelli commented on code in PR #19374:
URL: https://github.com/apache/pulsar/pull/19374#discussion_r1107294622
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -204,23 +206,46 @@ protected CompletableFuture<List<String>>
internalGetNonPersistentTopics(Policie
});
}
- @SuppressWarnings("unchecked")
- protected CompletableFuture<Void> internalDeleteNamespaceAsync(boolean
force) {
- CompletableFuture<Policies> preconditionCheck =
precheckWhenDeleteNamespace(namespaceName, force);
- return preconditionCheck
+ /**
+ * 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<>();
+ internalRetryableDeleteNamespaceAsync0(force, 5, future);
+ return future;
+ }
+ private void internalRetryableDeleteNamespaceAsync0(boolean force, int
retryTimes,
+ @Nonnull
CompletableFuture<Void> callback) {
+ if (retryTimes == 0) {
+ // drop out recursive
Review Comment:
we should fail here and we should not never reach here
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -299,7 +314,23 @@ protected CompletableFuture<Void>
internalDeleteNamespaceAsync(boolean force) {
return
CompletableFuture.completedFuture(null);
})
).collect(Collectors.toList())))
- .thenCompose(ignore -> internalClearZkSources());
+ .thenCompose(ignore -> internalClearZkSources())
+ .whenComplete((result, error) -> {
+ if (error != null) {
+ final Throwable rc =
FutureUtil.unwrapCompletionException(error);
+ if (rc instanceof MetadataStoreException) {
+ if (rc.getCause() != null && rc.getCause()
instanceof KeeperException.NotEmptyException) {
Review Comment:
here we must check that the number of retries is exhausted and do not
perform the recursion
--
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]