Frage

I have the ff. sample queries in this sequence:

  1. START TRANSACTION
  2. UPDATE
  3. INSERT
  4. 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:

  1. I have innodb_rollback_on_timeout set to ON, isn't query #3 supposed to be rolled back?

  2. Since I can't even manually roll back, what options do I have?

Note: This is on mariadb-10.4.17

War es hilfreich?

Lösung

What is the client? Does it have "auto reconnect" turned on? Turn it off.

What I think is happening:

  1. The UPDATE croaks (in any way) and gets rolled back.
  2. The connection is reestablished, perhaps with autocommit.
  3. The INSERT runs successfully and autocommits.
  4. The COMMIT is silently ignored.

Put error checks after every SQL statement.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit dba.stackexchange
scroll top