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

fix race condition when creating CoprDir #3075

Merged
merged 1 commit into from
Jan 2, 2024
Merged

Conversation

xsuchy
Copy link
Member

@xsuchy xsuchy commented Dec 20, 2023

We create new CoprDir but then call send_createrepo() and if somebody in meantime create CoprDir we got sqlalchemy.exc.IntegrityError and the end of send_createrepo when SQLAlchemy flushes.

Fixes: #3058

@xsuchy
Copy link
Member Author

xsuchy commented Dec 20, 2023

Note that I did not tested this as I have no idea how to test it.

We create new CoprDir but then call send_createrepo() and if somebody in
meantime create CoprDir we got sqlalchemy.exc.IntegrityError and the end
of send_createrepo when SQLAlchemy flushes.

Fixes: fedora-copr#3058
@FrostyX
Copy link
Member

FrostyX commented Dec 20, 2023

Note that I did not tested this as I have no idea how to test it.

Same here :-/

and if somebody in meantime create CoprDir

That sounds reasonable to me. But wouldn't the parallel curl command from #3058 reproduce the issue? Maybe I used the parallel command incorrectly?

@praiskup
Copy link
Member

praiskup commented Jan 1, 2024

I'm curious if we could use this: https://github.com/enricobarzetti/sqlalchemy_get_or_create

@FrostyX FrostyX merged commit c1fa04b into fedora-copr:main Jan 2, 2024
7 checks passed
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.

ISE psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "ownername_copr_dir_uniq"
3 participants