shanielh opened a new pull request, #925:
URL: https://github.com/apache/arrow-rs-object-store/pull/925

   # Which issue does this PR close?
   
   Closes #924.
   
   # Rationale for this change
   
   On GCS, `delete_stream` sends one `DELETE` per object, at most 10 at a time. 
S3 and Azure already use their native bulk delete APIs. Deleting many objects 
on GCS is therefore much slower than on the other clouds.
   
   # What changes are included in this PR?
   
   - **GCS bulk delete.** `delete_stream` now groups paths into chunks of 100 
(the [batch limit](https://cloud.google.com/storage/docs/batch)) and sends each 
chunk as one `POST {base_url}/batch/storage/v1` request. Up to 20 batches run 
at once, the same as AWS and Azure. Each part is a `DELETE 
/storage/v1/b/{bucket}/o/{url-encoded object}`. The outer request carries the 
bearer token, which GCS applies to every part. With `skip_signature`, the 
request is sent without a token.
   - **Results.** Response parts are matched to paths by `Content-ID`, so GCS 
may return parts in any order. Results still come back one per path, in input 
order. A part's status maps the same way a single-object request's status does: 
404 → `NotFound`, 403 → `PermissionDenied`, 401 → `Unauthenticated`, 412 → 
`Precondition`, anything else → `Generic`. The JSON error `message` is included 
in the error. If the response has no part for a path, that path gets an error; 
it is never reported as deleted. If the batch request itself fails, the error 
is returned once for that chunk, as on AWS and Azure.
   - **Opt-out.** New `GoogleCloudStorageBuilder::with_disable_bulk_delete` / 
`GoogleConfigKey::DisableBulkDelete` (`google_disable_bulk_delete`, 
`disable_bulk_delete`), mirroring the AWS option. When set, the store goes back 
to single deletes, at most 10 at a time. It is for GCS-compatible services that 
do not implement the batch endpoint.
   - **Shared multipart code.** The `multipart/mixed` request writer and 
response parser move from `src/azure/client.rs` into a new shared module, 
`src/client/batch.rs`, used by both Azure and GCS. Azure's request bodies are 
unchanged byte for byte; its existing `test_build_bulk_delete_body` checks 
this. The response parser now also accepts a quoted `boundary=` parameter. 
`gcp-base` now enables `httparse`, which `azure-base` already pulled in.
   - **Docs.** The "Bulk Delete Support" section of the `delete_stream` docs 
now lists GCP as a native bulk backend.
   
   # Are these changes tested?
   
   - **Unit tests:**
     - the exact batch request body, including URL-encoding of bucket and 
object names;
     - `Content-ID` parsing;
     - response parsing with parts out of order, 204, 404 → `NotFound`, 403 → 
`PermissionDenied` (with the JSON message), and 503 → `Generic`;
     - a missing response part, an out-of-range `Content-ID`, and a body that 
is not multipart.
   - **Mock-server tests:**
     - 150 paths go out as two batch requests (100 + 50) to `/batch/storage/v1` 
with the bearer token, and a 404 part maps to `NotFound` while every other path 
succeeds;
     - a failed batch request is returned once for its chunk;
     - with `disable_bulk_delete`, the store sends single `DELETE`s.
   - **Emulator tests:** `gcs_test` now also deletes 250 objects plus 2 missing 
ones, with bulk delete on and off. This runs against the fake-gcs-server image 
used in CI, which implements `/batch/storage/v1`.
   - **Not run:** I have not run this against real GCS. The request and 
response format follows Google's batch documentation.
   
   # Are there any user-facing changes?
   
   - `delete_stream` on GCS now sends batch requests by default.
   - New builder option `with_disable_bulk_delete` and new config key 
`GoogleConfigKey::DisableBulkDelete`. `GoogleConfigKey` is `#[non_exhaustive]`, 
so adding a variant is not a breaking change.
   - There are no other API changes.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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