Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document what happens in case of errors #7095

Open
droundy opened this issue Feb 7, 2025 · 1 comment
Open

document what happens in case of errors #7095

droundy opened this issue Feb 7, 2025 · 1 comment
Labels
enhancement Any new improvement worthy of a entry in the changelog

Comments

@droundy
Copy link

droundy commented Feb 7, 2025

I would like to know when BufWriter::shutdown() or flush() fail whether the write has partially succeeded. Ideally I'd like to have a way to upload such that the operation will be atomic, and the file will not end up in a partially-uploaded state.

Specifically, I'd like to have documented what the consequences of an error in flush or shutdown are.

@droundy droundy added the enhancement Any new improvement worthy of a entry in the changelog label Feb 7, 2025
@tustvold
Copy link
Contributor

tustvold commented Feb 8, 2025

All object store operations are atomic, and will never result in partially written files.

The only slight caveat is multipart uploads, which may leave partial uploads behind in certain exceptional cases, but these are not visible and only exist in a staging area. See https://docs.rs/object_store/latest/object_store/aws/index.html#multipart-uploads.

As for what happens on error, it depends on the error. In most cases the file won't be committed, however, if there was say a network error after the operation completed, an error will be reported but the operation will have succeeded.

TLDR everything is atomic, but as with any distributed system, you can have failures occur after transaction commit.

FWIW if you're concerned about error handling I would recommend avoiding BufWriter, as documented here, as whilst it is still atomic the relationship to the underlying operations is obfuscated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

No branches or pull requests

2 participants