I am rewriting this question because it has no answers.
I am trying to figure out the correct way to work with db transactions. Everything I see about how to make transactions is very simple:
- start request to start a transaction
- run your queries.
- if everything works fine, complete the transaction.
I get this, but this is a deadlock error that I am not getting. I heard about two options:
- Show the user a mistake and say "try again".
- Try again in place until this succeeds.
To me, telling the user to retry due to a technical problem, like this, seems to be bad - do real applications really do this regularly? Is it "oops something went wrong" when I see one-time errors? This is for a website, so users donβt even need to know about the database.
So, I have a few questions:
- What approach to failover should you take with data involving multiple users at once?
- If I use the "instant replay" option, what does this mean for a complex PHP script? Restart the entire query from above I worry that this will cause more problems than it solves.
- Is there a third option that I have not seen?
source
share