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

Add "NOWAIT" and "SKIP LOCKED" support to SELECT FOR UPDATE style query finder methods #2942

Open
mshannongit opened this issue May 14, 2024 · 1 comment

Comments

@mshannongit
Copy link

Feature description

currently to lock rows one can trigger a statement like the following
findTop5ByDepartmentEqualsForUpdate

however with concurrent threads wanting to run the same query, the second thread is blocked as it is trying to update potentially the same rows

to avoid this, one can use the SELECT FOR UPDATE SKIP LOCKED variant, which would allow the second thread to get a second set of non-locked rows; We need support in Micronaut Data thus for a query finder method like ...
findTop5ByDepartmentEqualsForUpdateSkipLocked

Similarly, we may want to quickly fail if rows are already locked, in which case we can use SELECT FOR UPDATE NOWAIT functionality.
findByNameEqualsForUpdateNoWait

@dstepanov
Copy link
Contributor

We might want to support it using the @QueryHint

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

No branches or pull requests

2 participants