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: adding ... FOR UPDATE to lock the row while client creation #235

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

geekbrother
Copy link
Contributor

@geekbrother geekbrother commented Oct 4, 2023

Description

Adding an additional SELECT ... FOR UPDATE statement for explicitly locks the row and avoids the unique constraint violation errors while executing create client transactions in parallel.

Resolves #230

How Has This Been Tested?

Passing functional CI unit tests.

Due Diligence

  • Breaking change
  • Requires a documentation update
  • Requires a e2e/integration test update

@geekbrother geekbrother self-assigned this Oct 4, 2023
@arein arein added the accepted The issue has been accepted into the project label Oct 4, 2023
@geekbrother geekbrother force-pushed the max/fix/add_for_update_to_delete branch from b90d157 to a2c9845 Compare October 4, 2023 20:03
@geekbrother geekbrother marked this pull request as ready for review October 4, 2023 20:07
@geekbrother geekbrother marked this pull request as draft October 4, 2023 20:32
@geekbrother geekbrother marked this pull request as ready for review October 5, 2023 09:05
@geekbrother
Copy link
Contributor Author

The expected behavior is that when the row is locked by SELECT ... FOR UPDATE another concurrent transaction with FOR UPDATE will wait until the first one COMMIT and will not throw any errors in this case.
More about FOR UPDATE and concurrent transactions: https://chat.openai.com/share/9cf007cd-fb8f-4281-ba66-e5924d884ca2

@geekbrother geekbrother merged commit 1de1a69 into main Oct 5, 2023
5 checks passed
@chris13524 chris13524 deleted the max/fix/add_for_update_to_delete branch October 5, 2023 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted The issue has been accepted into the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: duplicate key errors for the clients.id constraint
3 participants