-
Notifications
You must be signed in to change notification settings - Fork 10
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
Respond with 409 when creating duplicate asset blobs #2011
Conversation
bbf4360
to
a826de0
Compare
a826de0
to
ebf518d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the linting errors are fixed I think this is good to go.
dandi-cli downstream tests pass, but I wonder if we necessarily test such invocation. @jwodder WDYT - would there be effect on the client ? |
@yarikoptic I don't think this is relevant to any CLI tests. |
ebf518d
to
bae575d
Compare
@yarikoptic All set? |
I guess - testing in the wilderness would show ;-) |
🚀 PR was released in |
Fixes #1920
The existing upload pathway has a race condition where a competing asset blob gets created after our check. The
select_for_update
doesn't lock anything if it can't find any existing rows. Using get_or_create should handle this edge case. Even though we still need to handle these conditions, I'm curious why clients are concurrently uploading identical blobs 🤷♂️.I haven't tested this locally yet, but it's probably worth a sanity check already.