I need some advise.
What is the best thing to do when there is a Rollback after starting a transaction?
- Execute the rest of the website
- Kill the complete website, and display an error message.
Thanks!
I need some advise.
What is the best thing to do when there is a Rollback after starting a transaction?
Thanks!
It really depends on what you want to do.
However:
It really depends on why the MySQL ROLLBACK
statement was issued. The application had a reason for issuing it, so the application should have a code path for that set of conditions.
Normally, a ROLLBACK is called when some condition has made it impossible to continue forward. So, this is normally done as an abort. "Kill the complete website" sounds a bit drastic. If this transaction was a result of some user interaction, the polite thing to do would be to present a message to the user "A problem was encountered with your request, please try again later." (There's no reason to present a stack trace to the user.)
And the application should log the details of the error condition into the log, including the identity of the user and some sort of transaction id, the stack trace, and any other relevant information, for analysis.