Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-14916: [C++] GcsFileSystem can delete directories #11890

Closed
wants to merge 6 commits into from

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Dec 7, 2021

No description provided.

@github-actions
Copy link

github-actions bot commented Dec 7, 2021

@coryan coryan marked this pull request as ready for review December 8, 2021 14:31
@coryan coryan force-pushed the ARROW-14916-gcsfs-delete-dir branch from 7fea27a to df10c1f Compare December 9, 2021 15:46
Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, just a couple more suggestions.


auto async_delete =
[&p](gcs::Client& client,
google::cloud::StatusOr<gcs::ObjectMetadata> o) -> google::cloud::Status {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two suggestions:

  1. just capture the client as a closure parameter
  2. return an arrow Status here, such that you can use AllFinished(const std::vector<Future>&)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I captured this because capturing client_ is not possible in C++11.

// This iterates over all the objects, and schedules parallel deletes.
auto prefix = p.object.empty() ? gcs::Prefix() : gcs::Prefix(p.object);
for (auto& o : client_.ListObjects(p.bucket, prefix)) {
submitted.push_back(
Copy link
Member

@pitrou pitrou Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By using DeferNotOk (which turns a Result<Future<T>> into a Future<T>), you could instead append to a std::vector<Future>, which will simplify the collection code below.

For example (untested):

    std::vector<Future> submitted;
    // This iterates over all the objects, and schedules parallel deletes.
    auto prefix = p.object.empty() ? gcs::Prefix() : gcs::Prefix(p.object);
    for (auto& o : client_.ListObjects(p.bucket, prefix)) {
      submitted.push_back(DeferNotOk(
          io_context.executor()->Submit(async_delete, std::ref(client_), std::move(o))));
    }

    return AllFinished(submitted).status();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, thanks.

arrow::fs::AssertFileInfo(fs.get(), filename, FileType::NotFound);
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you test that other paths in the bucket still exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@pitrou pitrou closed this in fdc344b Dec 9, 2021
@coryan coryan deleted the ARROW-14916-gcsfs-delete-dir branch December 9, 2021 19:09
@ursabot
Copy link

ursabot commented Dec 9, 2021

Benchmark runs are scheduled for baseline = 3ef4032 and contender = fdc344b. fdc344b is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Failed ⬇️0.45% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.18% ⬆️0.0%] ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants