-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Avoid constantly attempting to acquire a lock #491
Conversation
70b2eea
to
cf8c72a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #491 +/- ##
=======================================
Coverage 57.05% 57.06%
=======================================
Files 277 277
Lines 14165 14168 +3
Branches 1901 1902 +1
=======================================
+ Hits 8082 8085 +3
Misses 5495 5495
Partials 588 588 ☔ View full report in Codecov by Sentry. |
This appears to prevent the infinite cycling. Still, if there is an expired writer on the queue (with a different lock Id), it will never be cleared away. Such could happen if the database is inaccessible when trying to remove the lock. I see that you don't put any ExpiresAt on the WriterQueue, leaving it null - they will hold forever (unless there is something else that causes it to crash out). Would this be plausible for the WriterQueue?
Is that overkill? Should we try for this fix and see if it resolves it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ddaspit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are circumstances where the writer queue doesn't get cleared properly. Your proposed solution would definitely work. It would result in extra queries/updates to the database. We would be trying to acquire the lock every 10 seconds instead of waiting until the currently acquired lock expired. Also, we would need to do an extra update for the ExpiresAt
property. Another option would be to add a timeout when attempting to acquire a lock. The timeout value could be used to set the ExpiresAt
property for the writer queue entry. If we want to deal with this possible case, we can do it in another PR.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ddaspit)
Sure. |
- ignore expiration timeout on WaitForChangesAsync when there are queued writer locks
cf8c72a
to
80f4c6e
Compare
This change is