Skip to content

Commit

Permalink
Azure: parallelize remove_dir. (#3357)
Browse files Browse the repository at this point in the history
This parallelizes remove_dir for azure.

TYPE: IMPROVEMENT
DESC: Azure: parallelize remove_dir.
  • Loading branch information
KiterLuc committed Jul 24, 2022
1 parent e9de89f commit b98c2c0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tiledb/sm/filesystem/azure.cc
Expand Up @@ -43,6 +43,7 @@
#include "tiledb/common/logger_public.h"
#include "tiledb/sm/filesystem/azure.h"
#include "tiledb/sm/global_state/global_state.h"
#include "tiledb/sm/misc/parallel_functions.h"
#include "tiledb/sm/misc/tdb_math.h"
#include "tiledb/sm/misc/utils.h"

Expand Down Expand Up @@ -887,9 +888,11 @@ Status Azure::remove_dir(const URI& uri) const {

std::vector<std::string> paths;
RETURN_NOT_OK(ls(uri, &paths, ""));
for (const auto& path : paths) {
RETURN_NOT_OK(remove_blob(URI(path)));
}
auto status = parallel_for(thread_pool_, 0, paths.size(), [&](size_t i) {
RETURN_NOT_OK(remove_blob(URI(paths[i])));
return Status::Ok();
});
RETURN_NOT_OK(status);

return Status::Ok();
}
Expand Down

0 comments on commit b98c2c0

Please sign in to comment.