#12949·neon

GCS backend: delete_objects chunks by max_keys_per_delete() but still deletes one object per request

Author: raunak2007Created Sep 25, 2026Updated Sep 25, 2026

GCSBucket::delete_objects (libs/remote_storage/src/gcs_bucket.rs:~1165) chunks paths by self.max_keys_per_delete() and then iterates every element of every chunk calling delete_oneshot individually, so the chunking has no effect and deletes are N sequential requests.

Two leftovers suggest this is an incomplete port of the S3 path rather than intentional:

  • let mut delete_objects: Vec<String> = Vec::with_capacity(paths.len()); is allocated at the top and never pushed to. S3Bucket::delete_objects (s3_bucket.rs:950) allocates the same vector, fills it with ObjectIdentifiers, and issues a single batched delete_oids per chunk.
  • rustc flags both delete_objects as unused and GCSBucket::max_keys_per_delete as never used, alongside unused from/cancel params and an unused TryStreamExt import in the same file.

Correctness looks fine, objects do get deleted. The cost is request volume: deleting a large layer set issues one request per object where S3 batches. Relevant to GC and timeline deletion, cf. #10265.

Happy to send a PR using GCS batch delete if that's wanted, though I don't have a GCS account to test against, so I'd want guidance on how you validate this backend. Found while building the repo locally (initial GCS support #11666, later delete fix #12873).