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/07/19 10:21:50 UTC
[GitHub] [pulsar] mattisonchao commented on a diff in pull request #16676: [fix][broker] Retry to delete the namespace if new topics created during the namespace deletion
mattisonchao commented on code in PR #16676:
URL: https://github.com/apache/pulsar/pull/16676#discussion_r924321275
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -346,8 +346,15 @@ protected void internalDeleteNamespace(AsyncResponse asyncResponse, boolean auth
asyncResponse.resume(Response.noContent().build());
})
.exceptionally(ex -> {
- log.error("[{}] Failed to remove namespace {}", clientAppId(), namespaceName, ex.getCause());
- resumeAsyncResponseExceptionally(asyncResponse, ex);
+ Throwable cause = FutureUtil.unwrapCompletionException(ex);
+ log.error("[{}] Failed to remove namespace {}", clientAppId(), namespaceName, cause);
+ if (cause instanceof PulsarAdminException.ConflictException) {
+ log.info("[{}] There are new topics created during the namespace deletion, "
+ + "retry to delete the namespace again.", namespaceName);
+ internalDeleteNamespace(asyncResponse, authoritative);
Review Comment:
Infinite loop/ stack overflow risk?
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -538,13 +545,13 @@ protected void internalDeleteNamespaceForcefully(AsyncResponse asyncResponse, bo
FutureUtil.waitForAll(bundleFutures).thenCompose(__ -> internalClearZkSources()).handle((result, exception) -> {
if (exception != null) {
- if (exception.getCause() instanceof PulsarAdminException) {
- asyncResponse.resume(new RestException((PulsarAdminException) exception.getCause()));
- return null;
+ Throwable cause = FutureUtil.unwrapCompletionException(exception);
+ if (cause instanceof PulsarAdminException.ConflictException) {
+ internalDeleteNamespaceForcefully(asyncResponse, authoritative);
Review Comment:
forget `return` here?
--
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