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

Race condition with SET NULL constraints #591

Closed
stephenh opened this issue Mar 29, 2023 · 1 comment · Fixed by #593
Closed

Race condition with SET NULL constraints #591

stephenh opened this issue Mar 29, 2023 · 1 comment · Fixed by #593
Labels

Comments

@stephenh
Copy link
Collaborator

We can issue SQL where em.flush:

  1. DELETEs an entity like Author
    • Another entity like Book has books.author_id with a SET NULL on delete action
    • This automatically sets books.author_id = NULL for this Book
    • The SQL trigger bumps books.updated_at for that Book
  2. Joist does its own UPDATE books SET author = null WHERE id = ... AND updated_at = last_updated_at
    • This fails with an oplock failure b/c the trigger bumped the updated_at to not equal our last_updated_at

Potential solution is that we issue all UPDATEs first, so that they won't be invalidated by ON DELETE behavior?

stephenh added a commit that referenced this issue Mar 29, 2023
stephenh pushed a commit that referenced this issue Mar 30, 2023
## [1.69.1](v1.69.0...v1.69.1) (2023-03-30)

### Bug Fixes

* Fix DELETEs bumping oplocks for UPDATEs. ([#593](#593)) ([5817469](5817469)), closes [#591](#591)
@stephenh
Copy link
Collaborator Author

🎉 This issue has been resolved in version 1.69.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

1 participant