PROBLEM
I recently encountered the error 2013 in MySql (Lost connection to MySQL server during query) while executing the COMMIT
statement for a transaction (the previous update statements succeeded). This was due to a network downtime error during the commit.
Then I started a new connection, and upon checking the transaction effects I could see that the transaction was indeed committed successfully and there were no errors (the changes were applied).
QUESTIONS
How can I be 100% sure that the commit succeeded when there are errors during the COMMIT
query? Did anyone find a similar problem? What would be the best approach here when this ambiguity arises? Is there a way to avoid this 'commit ambiguity'?
PREVIOUS RESEARCH
I found some related questions to other databases and MySql here:
- Is a Postgres long-running query aborted if the connection is lost/broken?
- What happens if the database node's network fails just after commit and before responding to the client
- Conditions that can make a MySQL COMMIT query fail?
- What if a connection closes in the middle of a commit?
- https://stackoverflow.com/questions/3960189/can-a-commit-statement-in-sql-ever-fail-how
But it doesn't seem that there is a way to avoid this problem?
Thank you!