wolfstudy commented on a change in pull request #12711:
URL: https://github.com/apache/pulsar/pull/12711#discussion_r747940904
##########
File path:
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/BaseResources.java
##########
@@ -194,6 +197,38 @@ protected static void deleteRecursive(BaseResources
resources, final String path
}
}
+ protected static CompletableFuture<Void>
deleteRecursiveAsync(BaseResources resources, final String pathRoot) {
+ PathUtils.validatePath(pathRoot);
+ List<String> tree = null;
+ try {
+ tree = listSubTreeBFS(resources, pathRoot);
+ } catch (MetadataStoreException e) {
+
+ }
+
+ if (tree != null) {
+ log.debug("Deleting {} with size {}", tree, tree.size());
+ log.debug("Deleting " + tree.size() + " subnodes ");
+
+ final List<CompletableFuture<Void>> futures = new ArrayList<>();
+ for (int i = tree.size() - 1; i >= 0; --i) {
+ // Delete the leaves first and eventually get rid of the root
+ futures.add(resources.deleteAsync(tree.get(i)));
+ }
+
+ FutureUtil.waitForAll(futures).handle((result, exception) -> {
+ if (exception != null) {
+ log.error("Failed to remove partitioned topics",
exception);
+ return null;
+ }
+ Response.noContent().build();
Review comment:
yes, will remove this
##########
File path:
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/BaseResources.java
##########
@@ -194,6 +197,38 @@ protected static void deleteRecursive(BaseResources
resources, final String path
}
}
+ protected static CompletableFuture<Void>
deleteRecursiveAsync(BaseResources resources, final String pathRoot) {
+ PathUtils.validatePath(pathRoot);
+ List<String> tree = null;
+ try {
+ tree = listSubTreeBFS(resources, pathRoot);
+ } catch (MetadataStoreException e) {
+
+ }
+
+ if (tree != null) {
+ log.debug("Deleting {} with size {}", tree, tree.size());
+ log.debug("Deleting " + tree.size() + " subnodes ");
Review comment:
Ok, will delete it
--
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]