Xuanwo opened a new pull request, #8739:
URL: https://github.com/apache/opendal/pull/8739

   # Which issue does this PR close?
   
   Follow-up to #8657.
   
   # Rationale for this change
   
   #8657 made staged conditional writes (`atomic_write_dir` + `if_not_exists`) 
atomic on Linux via `RENAME_NOREPLACE`, but rejected the combination as 
`Unsupported` on every other platform. It also dropped the fail-fast 
destination check at writer creation, so a conditional writer staged the full 
payload before the commit could reject it.
   
   # What changes are included in this PR?
   
   - On non-Linux platforms the staged conditional commit now publishes with 
`std::fs::hard_link`, which atomically fails with `AlreadyExists` instead of 
replacing an existing destination, then removes the staging entry. 
`AlreadyExists` maps to `ErrorKind::ConditionNotMatch` through the same 
`parse_error` path used on Linux, and a failed publish still cleans up the 
staged file. Hard links require one filesystem, which atomic publish already 
requires for its rename.
   - Restored the fail-fast destination check in `FsWriter::create` for 
`if_not_exists` writes under `atomic_write_dir`.
   - `write_with_if_not_exists` is now always reported for fs; 
`capabilities.json` regenerated and fs docs updated.
   - `write_conditions` tests now run on all platforms and cover: racing 
conditional writers, a destination created between open and commit, creating a 
missing destination, preserving an existing file, and unconditional overwrite 
still replacing.
   
   # Are there any user-facing changes?
   
   Yes. On non-Linux platforms, writes with `if_not_exists(true)` under 
`atomic_write_dir` now succeed and return `ErrorKind::ConditionNotMatch` when 
the destination exists, instead of failing with `ErrorKind::Unsupported` at 
writer creation. Linux behavior is unchanged.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Harness: pi coding agent (T3 Code)
   - Model: devin/swe-2
   - Effort: max
   - Role: Implemented the change and tests. Verified locally on Linux; the 
non-Linux code branch was compile-checked for `x86_64-pc-windows-gnu`, while 
macOS/BSD behavior relies on the documented POSIX `link()` semantics and CI.


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