This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Start work on avoiding table locks for upserts #2684
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a loop to _simple_upsert so that it can be used without a lock in more
circumstances, and a PoC to demonstrate it in
add_pusher
.WDYT?
Anyway, it's all very well but doesn't really help us for more complex
operations where we do more than one thing in the transaction (for example,
delete_pusher_by_app_id_pushkey_user_id
). There we have a few options:decide that the delete from
pushers
and the upsert intodeleted_pushers
don't actually need to happen in a single transaction, and use
_simple_upsert
there toocargo-cult the loop from
_simple_upsert
intodelete_pusher_by_app_id_pushkey_user_id
factor out the loop to a
retry_on_integrity_error
or something and use that