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

ObjectStore bulk delete #5591

Closed
thinkharderdev opened this issue Apr 4, 2024 · 2 comments
Closed

ObjectStore bulk delete #5591

thinkharderdev opened this issue Apr 4, 2024 · 2 comments
Labels
enhancement Any new improvement worthy of a entry in the changelog

Comments

@thinkharderdev
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

Deleting a lot of objects from an ObjectStore can be expensive if you have to do a separate API call for each object. In scenarios where you have to delete a lot of objects in a batch (eg a compaction process) this can be very annoying and resource intensive.

It would be helpful to add a bulk_delete method to ObjectStore that can take advantage of underlying APIs that allow for bulk deletion (eg S3 DeleteObjects API).

The default implementation can just call delete on each path serially if the underlying ObjectStore does not have an API for bulk deletion or we can throw an unimplemented error instead.

Describe the solution you'd like

pub struct BulkDeleteResult {
/// Count of objects successfully deleted
deleted: usize,
/// Errors for individual objects which could not be deleted for some reason,
errors: Vec<(Path,Error)>,
}

Something like

pub trait ObjectStore {
  
  async fn bulk_delete(&self, locations: &[Path]) -> Result<BulkDeleteResult>;

}

Describe alternatives you've considered

Do nothing

Additional context

@thinkharderdev thinkharderdev added the enhancement Any new improvement worthy of a entry in the changelog label Apr 4, 2024
@tustvold
Copy link
Contributor

tustvold commented Apr 5, 2024

@thinkharderdev
Copy link
Contributor Author

Ugh, not sure how I missed that :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

No branches or pull requests

2 participants