Lost connection to the database during COMMIT query: did the transaction succeed or not?
1
vote
1
answer
661
views
# 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:
- https://dba.stackexchange.com/questions/81408/is-a-postgres-long-running-query-aborted-if-the-connection-is-lost-broken/81424#81424
- https://dba.stackexchange.com/questions/215579/what-happens-if-the-database-nodes-network-fails-just-after-commit-and-before-r
- https://dba.stackexchange.com/questions/284526/conditions-that-can-make-a-mysql-commit-query-fail
- https://dba.stackexchange.com/questions/204691/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!
Asked by bruno-kakele
(11 rep)
May 20, 2023, 04:47 PM
Last activity: Apr 19, 2025, 05:09 AM
Last activity: Apr 19, 2025, 05:09 AM