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

sql.Tx retries #49

Open
cjslep opened this issue Dec 18, 2020 · 0 comments
Open

sql.Tx retries #49

cjslep opened this issue Dec 18, 2020 · 0 comments
Labels
feature request New request for novel functionality
Milestone

Comments

@cjslep
Copy link
Member

cjslep commented Dec 18, 2020

In a federated context, the go-fed library uses mutexes associated with specific IRIs before running associated business logic. However, this still doesn't prevent sql transactional conflicts at the service layer since it is not aware of mutexes. This can lead to transactional conflicts, which are not currently addressed. There are some different ways of approaching this:

  1. Make a conceptual layer above service aware of the mutexes to lock in advance. I don't like this due to the open-ended nature of client code, which can lead to a leaky abstraction via opaque deadlocks. No fun for anyone.
  2. Do not actually lock any mutexes in federated contexts, and introduce transactions instead into federated contexts, so that everything is tx-based, as Contexts can map 1 request to 1 tx. So a tx conflict is simply a matter of re-trying all the logic since that mapping is instantiated.
  3. Refactor go-fed/activity to be transaction-aware instead of mutex-based, but as seen above, we can in theory make our implementation of go-fed/activity tx-based instead of mutex-based. I'm not confident a refactor of go-fed/activity to be tx-based would permit the lightweight mutex-based approach (which has its own benefits like enabling lightweight apps such as the testsuite).

It's labelled as a feature enhancement right now because it should result in a stability improvement in case of high sustained QPS / burst of QPS.

@cjslep cjslep added the feature request New request for novel functionality label Dec 18, 2020
@cjslep cjslep added this to the v0.1.0 milestone Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New request for novel functionality
Projects
None yet
Development

No branches or pull requests

1 participant