diff --git a/.github/services/s3/ceph_radios_s3_with_versioning/disable_action.yml b/.github/services/s3/ceph_radios_s3_with_versioning/disable_action.yml index 7838f5f52023..71b550d91e25 100644 --- a/.github/services/s3/ceph_radios_s3_with_versioning/disable_action.yml +++ b/.github/services/s3/ceph_radios_s3_with_versioning/disable_action.yml @@ -44,4 +44,5 @@ runs: OPENDAL_S3_SECRET_ACCESS_KEY=demo OPENDAL_S3_REGION=us-east-1 OPENDAL_S3_ENABLE_VERSIONING=true + OPENDAL_S3_DISABLE_WRITE_WITH_IF_MATCH=on EOF diff --git a/.github/services/s3/ceph_rados_s3/action.yml b/.github/services/s3/ceph_rados_s3/action.yml index dfb4b5ad6a6f..54e6e7049ddb 100644 --- a/.github/services/s3/ceph_rados_s3/action.yml +++ b/.github/services/s3/ceph_rados_s3/action.yml @@ -41,4 +41,5 @@ runs: OPENDAL_S3_ACCESS_KEY_ID=demo OPENDAL_S3_SECRET_ACCESS_KEY=demo OPENDAL_S3_REGION=us-east-1 + OPENDAL_S3_DISABLE_WRITE_WITH_IF_MATCH=on EOF diff --git a/core/src/services/s3/backend.rs b/core/src/services/s3/backend.rs index b53ff2ddd38d..d14428758161 100644 --- a/core/src/services/s3/backend.rs +++ b/core/src/services/s3/backend.rs @@ -548,6 +548,12 @@ impl S3Builder { self } + /// Disable write with if match so that opendal will not send write request with if match headers. + pub fn disable_write_with_if_match(mut self) -> Self { + self.config.disable_write_with_if_match = true; + self + } + /// Detect region of S3 bucket. /// /// # Args @@ -878,6 +884,7 @@ impl Builder for S3Builder { client, batch_max_operations, checksum_algorithm, + disable_write_with_if_match: self.config.disable_write_with_if_match, }), }) } @@ -924,7 +931,7 @@ impl Access for S3Backend { write_can_multi: true, write_with_cache_control: true, write_with_content_type: true, - write_with_if_match: true, + write_with_if_match: !self.core.disable_write_with_if_match, write_with_if_not_exists: true, write_with_user_metadata: true, diff --git a/core/src/services/s3/config.rs b/core/src/services/s3/config.rs index b1b31d5bbc72..cbcef7a207d6 100644 --- a/core/src/services/s3/config.rs +++ b/core/src/services/s3/config.rs @@ -173,6 +173,10 @@ pub struct S3Config { /// Available options: /// - "crc32c" pub checksum_algorithm: Option, + /// Disable write with if match so that opendal will not send write request with if match headers. + /// + /// For example, Ceph RADOS S3 doesn't support write with if match. + pub disable_write_with_if_match: bool, } impl Debug for S3Config { diff --git a/core/src/services/s3/core.rs b/core/src/services/s3/core.rs index eed949819634..6d6eb746582a 100644 --- a/core/src/services/s3/core.rs +++ b/core/src/services/s3/core.rs @@ -98,6 +98,7 @@ pub struct S3Core { pub client: HttpClient, pub batch_max_operations: usize, pub checksum_algorithm: Option, + pub disable_write_with_if_match: bool, } impl Debug for S3Core { diff --git a/core/src/services/s3/docs.md b/core/src/services/s3/docs.md index 4027f95cac2c..2145ce58f799 100644 --- a/core/src/services/s3/docs.md +++ b/core/src/services/s3/docs.md @@ -28,8 +28,9 @@ This service can be used to: - `server_side_encryption_customer_algorithm`: Set the server_side_encryption_customer_algorithm for backend. - `server_side_encryption_customer_key`: Set the server_side_encryption_customer_key for backend. - `server_side_encryption_customer_key_md5`: Set the server_side_encryption_customer_key_md5 for backend. -- `disable_config_load`: Disable aws config load from env +- `disable_config_load`: Disable aws config load from env. - `enable_virtual_host_style`: Enable virtual host style. +- `disable_write_with_if_match`: Diable write with if match. Refer to [`S3Builder`]'s public API docs for more information.