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 lock contention in RefreshHealth #1009

Merged
merged 3 commits into from
Feb 29, 2024
Merged

Conversation

ChrisSchinnerl
Copy link
Member

@ChrisSchinnerl ChrisSchinnerl commented Feb 28, 2024

RefreshHealth often failed on Arequipa as soon as slabs was updated. It immediately returned a database is locked error. It also happened only while migrating which explains the deadlock since migrations also update the slabs.

To avoid that, this PR changes the slab update to happen in a single query. That way SQLite knows that the transaction is a write transaction right away and doesn't start out as a read transaction that is then aborted.

Another small change I'm testing, since I'd like to avoid creating the temporary table after updating the slabs, is a new query for updating the objects which doesn't depend on the temporary table. The upside of this query is that it updates any object which is out-of-sync with its slabs rather than just the ones modified. However it will still only look at objects which require an update instead of all of them.

NOTE: deployed on Arequipa right now

@ChrisSchinnerl ChrisSchinnerl self-assigned this Feb 28, 2024
@ChrisSchinnerl ChrisSchinnerl marked this pull request as ready for review February 28, 2024 14:28
@ChrisSchinnerl ChrisSchinnerl merged commit 85141d3 into dev Feb 29, 2024
8 checks passed
@ChrisSchinnerl ChrisSchinnerl deleted the chris/refresh-health-lockup branch February 29, 2024 13:39
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

Successfully merging this pull request may close these issues.

2 participants