Skip to content

Commit

Permalink
fix(object_store): Continue operation in delete_objects function when… (
Browse files Browse the repository at this point in the history
  • Loading branch information
NiuBlibing authored Apr 8, 2024
1 parent 3ddec23 commit 9b74f68
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/object_store/src/object/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ impl ObjectStore for S3ObjectStore {
async fn delete_objects(&self, paths: &[String]) -> ObjectResult<()> {
// AWS restricts the number of objects per request to 1000.
const MAX_LEN: usize = 1000;
let mut all_errors = Vec::new();

// If needed, split given set into subsets of size with no more than `MAX_LEN` objects.
for start_idx /* inclusive */ in (0..paths.len()).step_by(MAX_LEN) {
Expand All @@ -512,9 +513,15 @@ impl ObjectStore for S3ObjectStore {

// Check if there were errors.
if !delete_output.errors().is_empty() {
return Err(ObjectError::internal(format!("DeleteObjects request returned exception for some objects: {:?}", delete_output.errors())));
all_errors.append(&mut delete_output.errors().to_owned());
}
}
if !all_errors.is_empty() {
return Err(ObjectError::internal(format!(
"DeleteObjects request returned exception for some objects: {:?}",
all_errors
)));
}

Ok(())
}
Expand Down

0 comments on commit 9b74f68

Please sign in to comment.