reidkaufmann opened a new pull request, #891:
URL: https://github.com/apache/arrow-rs-object-store/pull/891
# Which issue does this PR close?
- Closes #889.
# Rationale for this change
See the issue.
# What changes are included in this PR?
- `rename()` returns `RenameError::{Rename, Fsync}`, so a caller can tell a
failed rename from a failed fsync after it while the fsync stays bundled in the
one helper; `rename_opts` converts it back to `io::Error`.
- The publish helpers own the staging-file cleanup and return the metadata
taken before publishing: `finish_staged_rename` removes the file when it fails
before the rename succeeds and leaves it alone afterwards;
`finish_staged_hard_link` removes it whether or not the link was made (a hard
link never moves it). `put_opts` only cleans up after a failed write (on `main`
a `metadata` failure there also leaked the staging file); `complete` takes the
metadata from the helper.
- `copy_opts` with `CopyMode::Overwrite` removes `to#N` only when the rename
itself failed.
- `Error::Metadata` from `put_opts` now names the staging file, as
`complete`'s already did, because one helper takes the metadata for both. Error
variants are unchanged.
Tests:
- `multipart_complete_failure_removes_staging_file` fails on `main`
(`assertion failed: !staging.exists()`).
- `put_failure_removes_staging_file` passes on `main`; it guards the
Overwrite and Create cleanup that moved from `put_opts` into the helpers.
- The rule "never remove after a successful rename" (`finish_staged_rename`,
`copy_opts`) is untested: it needs a directory fsync that fails after the
rename, which cannot be induced without a hook. `sync_all`/`close` failures
were not induced either; they take the same path as the rename failure the
tests use.
Locally: `cargo fmt --check`, the CI clippy matrix with `-D warnings`,
`cargo test`, `cargo test --all-features`, rustdoc with `-D warnings`, `cargo
+1.85.0 check --all-targets --all-features`. Not run on Windows, where the
tests rely on renaming a file over a non-empty directory failing.
# Are there any user-facing changes?
`Error::Metadata` from `put_opts` names the staging file instead of the
destination. No API changes.
# AI usage
Written with AI assistance; I reviewed the changes and tests.
--
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]