MariaDB InnoDB does not rollback on timeout
-
13-03-2021 - |
Question
I have the ff. sample queries in this sequence:
- START TRANSACTION
- UPDATE
- INSERT
- COMMIT
Query #2 is timing out but I noticed that query #3 is not rolled back.
I am also trying to manually rollback by verifying (querying the table) if the updates went through before I commit. But when I do that, I get an explicit: General error: 2006 MySQL server has gone away
error.
My questions:
I have
innodb_rollback_on_timeout
set toON
, isn't query #3 supposed to be rolled back?Since I can't even manually roll back, what options do I have?
Note: This is on mariadb-10.4.17
Solution
What is the client? Does it have "auto reconnect" turned on? Turn it off.
What I think is happening:
- The
UPDATE
croaks (in any way) and gets rolled back. - The connection is reestablished, perhaps with
autocommit
. - The
INSERT
runs successfully and autocommits. - The
COMMIT
is silently ignored.
Put error checks after every SQL statement.
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange