You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "XuQianJin-Stars (via GitHub)" <gi...@apache.org> on 2026/08/20 12:09:25 UTC

[PR] fix(services/goosefs): make Master rename authoritative in rename path [opendal]

XuQianJin-Stars opened a new pull request, #8120:
URL: https://github.com/apache/opendal/pull/8120

   GooseFS rename did preparatory work before consulting Master: it created
   the destination parent on every call, and in the overwrite path it
   deleted the destination up front. Both were wrong or needlessly slow.
   
   `create_directory` on an already persisted parent is not a cheap no-op
   under `CACHE_THROUGH`, so it cost an extra `UFS` round trip on every rename.
   Deleting the destination first meant that renaming a missing source onto
   an existing file removed that file and still returned `NotFound`; any
   transient Master error between the delete and the rename had the same
   effect.
   
   Attempt Master rename first, since it is authoritative for both source
   existence and the no-replace conflict, and make every recovery step
   conditional on what Master reports:
   
   - Create the destination parent only when Master reports it missing, then
     retry once. When that mkdir fails, keep the original rename error so a
     missing source still surfaces as NotFound instead of the mkdir failure.
   - Delete the destination only after a conflict proves the source exists.
   
   This also drops the pre-flight `get_status` from the common path. Adds a
   regression test asserting that a rename whose source is missing leaves
   the destination intact.
   
   # Which issue does this PR close?
   
   Closes #.
   
   # Rationale for this change
   
   GooseFS Master rename already answers source existence and destination
   conflicts. The previous client-side probes were redundant on the happy
   path and unsafe on the overwrite path.
   
   Lance `PutMode::Create` on GooseFS is implemented as
   `write_with(...).if_not_exists(true)` → temp file +
   `rename(..., if_not_exists=true)`. Making Master rename the first and
   authoritative step keeps that exclusive-create contract, and avoids a
   CACHE_THROUGH UFS round trip on every publish.
   
   # What changes are included in this PR?
   
   - Reorder `GoosefsCore::rename` so Master `rename` runs first.
   - Create the destination parent only after Master reports it missing;
     retry once. If mkdir fails, return the original rename error.
   - On overwrite, delete the destination only after Master reports a
     conflict (source exists). Never delete when `if_not_exists` is set.
   - Drop the pre-flight `get_status` from the common rename path.
   - Document the new rename recovery rules in the GooseFS service docs.
   - Add `rename_missing_source_preserves_dst` to
     `safe_conditional_put.rs`.
   
   # Are there any user-facing changes?
   
   GooseFS-only. Public capability flags are unchanged
   (`write_with_if_not_exists`, `rename_with_if_not_exists`).
   
   Behavior changes:
   
   - Rename of a missing source onto an existing destination no longer
     deletes the destination.
   - A missing source still returns `NotFound` even if creating the
     destination parent fails.
   - Successful rename of an existing nested path no longer always calls
     `create_directory` on the destination parent.
   
   No public API or breaking-changes label.
   
   # AI Usage Statement
   
   AI drafted the rename reorder, the mkdir error-preserving retry, the
   overwrite-delete guard, and the regression test. Review should treat
   Master no-replace rename as the exclusive-create authority, and treat
   mkdir-and-retry as a single speculative recovery rather than a loop.


-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/goosefs): make Master rename authoritative in rename path [opendal]

Posted by "XuQianJin-Stars (via GitHub)" <gi...@apache.org>.
XuQianJin-Stars closed pull request #8120: fix(services/goosefs): make Master rename authoritative in rename path
URL: https://github.com/apache/opendal/pull/8120


-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org