hcrosse opened a new issue, #920:
URL: https://github.com/apache/arrow-rs-object-store/issues/920

   **Describe the bug**
   
   In 
[`S3Client::bulk_delete_request`](https://github.com/apache/arrow-rs-object-store/blob/main/src/aws/client.rs#L625),
 per key `<Error>` entries from `<DeleteResult>` are mapped back to `results` 
with `paths.iter().find_position(|&p| p == &path).unwrap().0`:
   
   1. If the response contains an `<Error><Key>` that does not match any 
requested path in `paths`, the `.unwrap()` panics the task instead of returning 
`Error::InvalidDeleteObjectsResponse` (even though `Path::parse` three lines 
above already returns `InvalidDeleteObjectsResponse`).
   2. If `paths` contains duplicate entries (for example `[a, b, a]`) and 
deletion of `a` fails with `<Error>`, `find_position` only updates the first 
matching index, leaving subsequent duplicate entries as `Ok(a)` even when the 
server returns multiple `<Error>` entries.
   
   **To Reproduce**
   
   1. Call `delete_stream` with `["requested.txt"]` against an S3 endpoint 
returning 
`<DeleteResult><Error><Key>unexpected/other.txt</Key><Code>AccessDenied</Code><Message>Denied</Message></Error></DeleteResult>`.
 The task panics at `src/aws/client.rs:632`.
   2. Call `delete_stream` with `["protected.txt", "ok.txt", "protected.txt"]` 
against an endpoint returning `<Deleted>` for `ok.txt` and one or two `<Error>` 
entries for `protected.txt`. Index 0 is `Err`, while index 2 returns 
`Ok("protected.txt")`.
   
   **Expected behavior**
   
   An unknown `<Error><Key>` should return 
`Error::InvalidDeleteObjectsResponse` instead of panicking. Every occurrence of 
a failing duplicate key in `paths` should receive the corresponding `Err`.
   
   **Additional context**
   
   Mapping errors through a lazily built `HashMap<&Path, Vec<usize>>` also 
avoids scanning `paths` per error while keeping zero map allocation on the all 
success path.
   


-- 
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]

Reply via email to