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

Allow filesystem backend put_obj to overwrite existing #376

Merged
merged 4 commits into from
Aug 11, 2021
Merged

Conversation

mosyp
Copy link
Contributor

@mosyp mosyp commented Aug 11, 2021

A follow up of #367. put_obj has to follow the semantic of replace existing which was violated with recent changes. There's atomic swap supported by additional flags of rename2 but it only works if both files are present. As a workaround I'm adding a files_exists() call to determine which rename to call.

@mosyp mosyp enabled auto-merge (squash) August 11, 2021 14:34
@mosyp mosyp merged commit e457ed1 into main Aug 11, 2021
@mosyp mosyp deleted the fix-fs-put-obj branch August 11, 2021 14:43
Ok(_) => Ok(()),
Err(e) => {
// If rename failed, clean up the temp file.
self.delete_obj(tmp_path).await?;
//self.delete_obj(tmp_path).await?;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😞

@houqp
Copy link
Member

houqp commented Aug 13, 2021

@mosyp I think we have a race condition in this change. The file could be deleted or created between the path exists check and the atomic rename call. Could you check my comment at #367 (comment) to see if what I said there makes sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants