-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: Remove unnecessary transaction #3029
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3029 +/- ##
==========================================
- Coverage 79.42% 79.40% -0.03%
==========================================
Files 112 112
Lines 7889 7889
==========================================
- Hits 6266 6264 -2
- Misses 1222 1223 +1
- Partials 401 402 +1
Continue to review full report at Codecov.
|
You're right, that should indeed be a background task. But we can merge this as is already, thank you! |
Note: are you sure it is OK that some transactions are not using |
Since RepeatableRead is the highest isolation level, and might only manifest at significant scale, I think it's fine for now to not set them explicitly. Some databases like CRDB have RR as the default level in any case :) |
Sorry to nitpick, but "serializable" is the highest isolation level. :-) Also, we had issues (and this is how I discovered this code) at a pretty low scale: it was pretty common to get "transaction aborted" with repeatable read before this code change, because the delete query touches the whole table, so two parallel queries had always a conflict. Anyway, if you know what you are doing and why is |
I see, to be honest I haven't looked into the code in a while and it always requires cognitive load to do that. If this is an issue that is bothering you in production and is causing problems in delivering the service, please feel free to open an issue with a problem statement, reproducible case, and ideas on how to resolve it. If that's not the case I'll refrain from trying to think myself through this :) |
No, issues on my side has been resolved. So this is all fine now. I just wanted to put this isolation-level discrepancy on your radar so that if in the future you might learn about some issue with isolation, you might remember that parts of queries are using one isolation level and parts another. |
Love it, thanks :) You show a high level of trust in my ability to remember discussions. I hope it's not misplaced 😅 |
With some luck, I might also notice it and pitch in. :-) Have a good night! |
Thank you, you too! |
While resolving an issue in my own implementation of storage for Fosite which has been modeled after Hydra's, I realized:
BeginTX
usesLevelRepeatableRead
. Is this on purpose or is this a bug? In my implementation I always used the same way to create a transaction so I always had repeatable read transactions, which combined with the unnecessary transaction in this function lead to commit conflicts (because multiple parallel transactions were attempting to delete same expired assertions).Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security. vulnerability, I
confirm that I got green light (please contact
security@ory.sh) from the maintainers to push
the changes.
works.