Skip to content

services: inconsistent conditional write (if_match/if_none_match) support across s3, gcs, azblob #7889

Description

@shanielh

What would you like to be added?

Conditional-write support (if_match / if_none_match on write_with) is currently inconsistent across the S3-family object storage services:

  • S3: if_match is fully implemented. if_none_match with an arbitrary ETag is not implemented — this is a genuine limitation of the S3 API itself, since x-amz-if-none-match only ever accepts the literal wildcard *, which is already covered by if_not_exists().
  • Azure Blob: if_none_match is fully implemented, but if_match is missing even though Azure's Put Blob REST API supports If-Match with an arbitrary ETag.
  • GCS: Neither if_match nor if_none_match is implemented for writes. GCS's JSON API (used by OpenDAL for uploads) has no ETag-based conditional-write mechanism at all — only generation/metageneration-number query parameters (ifGenerationMatch, ifGenerationNotMatch), which is exactly what the existing if_not_exists()ifGenerationMatch=0 code already uses.

We should close the two gaps that are actually implementable given each provider's API:

  • Add write_with_if_match support to Azure Blob (wire If-Match into azblob_put_blob_request, mirroring the existing if_none_match handling).
  • Add write_with_if_match / write_with_if_none_match support to GCS on top of ifGenerationMatch / ifGenerationNotMatch, using the object's generation number (already exposed via Metadata::version()) rather than a literal ETag, since GCS has no ETag-based conditional-write primitive.

S3 requires no change, since its remaining gap is a hard API limitation rather than a missing implementation.

Why is this needed?

This enables optimistic-concurrency writes (e.g. "only overwrite if the object hasn't changed since I last read it") consistently across more backends, closing capability gaps that currently silently no-op (write_with_if_match/write_with_if_none_match report false even where the underlying API could support them).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions