Technoboy- commented on code in PR #15040:
URL: https://github.com/apache/pulsar/pull/15040#discussion_r843867753
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -284,59 +284,45 @@ protected void internalDeleteNamespace(AsyncResponse
asyncResponse, boolean auth
}
FutureUtil.waitForAll(futures).thenCompose(__ -> {
List<CompletableFuture<Void>> deleteBundleFutures =
Lists.newArrayList();
- return pulsar().getNamespaceService().getNamespaceBundleFactory()
- .getBundlesAsync(namespaceName).thenCompose(bundles -> {
- for (NamespaceBundle bundle : bundles.getBundles()) {
- // check if the bundle is owned by any broker, if
not then we do not need to delete
- // the bundle
-
deleteBundleFutures.add(pulsar().getNamespaceService().getOwnerAsync(bundle)
- .thenCompose(ownership -> {
- if (ownership.isPresent()) {
- try {
- return
pulsar().getAdminClient().namespaces()
-
.deleteNamespaceBundleAsync(namespaceName.toString(),
-
bundle.getBundleRange());
- } catch (PulsarServerException e) {
- throw new RestException(e);
- }
- } else {
- return
CompletableFuture.completedFuture(null);
- }
- }));
- }
- return FutureUtil.waitForAll(deleteBundleFutures);
- });
- })
- .handle((result, exception) -> {
- if (exception != null) {
- if (exception.getCause() instanceof PulsarAdminException) {
- asyncResponse.resume(new
RestException((PulsarAdminException) exception.getCause()));
- return null;
- } else {
- log.error("[{}] Failed to remove owned namespace {}",
clientAppId(), namespaceName, exception);
- asyncResponse.resume(new
RestException(exception.getCause()));
- return null;
- }
- }
-
+ NamespaceBundles bundles = null;
try {
- // we have successfully removed all the ownership for the
namespace, the policies znode can be deleted
- // now
- final String globalZkPolicyPath = path(POLICIES,
namespaceName.toString());
- final String localZkPolicyPath = joinPath(LOCAL_POLICIES_ROOT,
namespaceName.toString());
- namespaceResources().delete(globalZkPolicyPath);
- try {
- getLocalPolicies().delete(localZkPolicyPath);
- } catch (NotFoundException nne) {
- // If the z-node with the modified information is not
there anymore, we're already good
- }
+ bundles =
pulsar().getNamespaceService().getNamespaceBundleFactory()
+ .getBundles(namespaceName);
Review Comment:
Why change this to sync ? I mean `getBundles`, not `getBundlesAsync`?
--
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]