This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 15fcb1f00a fix(services/hf3fs): remove the write_with_if_not_exists
flag (#9302)
15fcb1f00a is described below
commit 15fcb1f00ac6582df5eb8beee36b95621547b97e
Author: Yao jietao <[email protected]>
AuthorDate: Sat Nov 28 23:52:46 2026 +0800
fix(services/hf3fs): remove the write_with_if_not_exists flag (#9302)
* fix(services/hf3fs): remove the write_with_if_not_exists flag
* test(services/hf3fs): expect Unsupported for conditional writes
The capability check rejects if_not_exists before the write reaches 3FS.
The real-service job for #9302 returned Unsupported at the assertion that still
expected ConditionNotMatch.
https://github.com/apache/opendal/actions/runs/46046591255/job/140673491418
* docs(services/hf3fs): explain conditional write migration
---------
Co-authored-by: Xuanwo <[email protected]>
---
core/core/src/docs/upgrade.md | 17 +++++++++++++++++
core/services/hf3fs/README.md | 3 ++-
core/services/hf3fs/src/backend.rs | 1 -
core/services/hf3fs/tests/real_service.rs | 2 +-
website/data/capabilities.json | 3 +--
5 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/core/core/src/docs/upgrade.md b/core/core/src/docs/upgrade.md
index b50e4fb806..258e2eb8bb 100644
--- a/core/core/src/docs/upgrade.md
+++ b/core/core/src/docs/upgrade.md
@@ -200,6 +200,23 @@ separately when constructing a `MultipartCopier`.
## Services
+### 3FS conditional writes
+
+`Hf3fs` no longer advertises `Capability::write_with_if_not_exists`. Earlier
+revisions of `main` used `if_not_exists` to open the final path with exclusive
+creation. An existing file caused `ErrorKind::ConditionNotMatch`. A new file
+could become visible before the write finished, and a failed or aborted write
+could leave a partial file.
+
+`write_with(...).if_not_exists(true)` and
`writer_with(...).if_not_exists(true)`
+now return `ErrorKind::Unsupported` before any service I/O, regardless of
whether
+the target exists.
+
+To publish a complete file atomically only when the target is absent, switch to
+a service whose operator advertises `write_with_if_not_exists` and keep
+`if_not_exists(true)`. Use a plain 3FS write only if overwriting is acceptable.
+A separate existence check leaves a race between the check and the write.
+
### Redb requires `redb` 5
`RedbBuilder::database` takes an `Arc<redb::Database>`, so the `redb` version
OpenDAL builds
diff --git a/core/services/hf3fs/README.md b/core/services/hf3fs/README.md
index 6997c1739e..19d5c2536c 100644
--- a/core/services/hf3fs/README.md
+++ b/core/services/hf3fs/README.md
@@ -27,7 +27,8 @@ Use the client library distributed with your 3FS deployment.
The service supports stat, range reads, streaming writes, create directory,
list, delete, recursive delete, and rename. Writes create parent directories
-and replace existing files; `if_not_exists` rejects an existing file.
+and replace existing files. Conditional writes with `if_not_exists` are
+unsupported.
Closing a writer waits for writes and synchronizes the file. Writes are not
atomic, and failed or aborted writes can leave partial files. Append, native
copy, presign, and rollback on abort are unsupported. Operations require a
diff --git a/core/services/hf3fs/src/backend.rs
b/core/services/hf3fs/src/backend.rs
index d3053ea015..8575a27de0 100644
--- a/core/services/hf3fs/src/backend.rs
+++ b/core/services/hf3fs/src/backend.rs
@@ -177,7 +177,6 @@ impl Service for Hf3fsBackend {
write: true,
write_can_empty: true,
write_can_multi: true,
- write_with_if_not_exists: true,
create_dir: true,
list: true,
delete: true,
diff --git a/core/services/hf3fs/tests/real_service.rs
b/core/services/hf3fs/tests/real_service.rs
index 2a29dfe392..2af51c5bdb 100644
--- a/core/services/hf3fs/tests/real_service.rs
+++ b/core/services/hf3fs/tests/real_service.rs
@@ -167,7 +167,7 @@ async fn overwrite_empty_and_exclusive_writes() {
.if_not_exists(true)
.await
.unwrap_err();
- assert_eq!(err.kind(), ErrorKind::ConditionNotMatch);
+ assert_eq!(err.kind(), ErrorKind::Unsupported);
assert_eq!(op.read("data").await.unwrap().len(), 9000);
op.write("data", "short").await.unwrap();
assert_eq!(std::fs::read(dir.path().join("data")).unwrap(), b"short");
diff --git a/website/data/capabilities.json b/website/data/capabilities.json
index 9e98cd82d9..3bf546354d 100644
--- a/website/data/capabilities.json
+++ b/website/data/capabilities.json
@@ -2184,8 +2184,7 @@
"stat": true,
"write": true,
"write_can_empty": true,
- "write_can_multi": true,
- "write_with_if_not_exists": true
+ "write_can_multi": true
}
},
{