Fehlerbehandlung (MySQL, InnoDB, Deadlock)

Pendergast

Erfahrenes Mitglied
Die MySQL-Dokumentation sagt Folgendes zur Fehlerbehandlung bei einer Nutzung der InnoDB-Engine:
A transaction deadlock causes InnoDB to roll back the entire transaction. In the case of a lock wait timeout, InnoDB also rolls back the entire transaction before MySQL 5.0.13; as of 5.0.13, InnoDB rolls back only the most recent SQL statement.

When a transaction rollback occurs due to a deadlock or lock wait timeout, it cancels the effect of the statements within the transaction. But if the start-transaction statement was START TRANSACTION or BEGIN statement, rollback does not cancel that statement. Further SQL statements become part of the transaction until the occurrence of COMMIT, ROLLBACK, or some SQL statement that causes an implicit commit.

Ich steig da im Moment nicht so durch. Im Normalbetrieb (sprich einzelne Statement, jede für sich) wird bei mir bis zu dreimal versucht ein Statement auszuführen, sofern ein Deadlock als Grund für einen Fehlschlag zurückgegeben wird.

Wenn ich jetzt aber zusammenhängende Statements mit START TRANSACTION einleite und irgendwo für ein Statement einen Deadlock gemeldet bekomme, darf ich dann das Statement nicht wiederholen, weil es dann plötzlich bis zu dreimal in meinem Statement-Block auftaucht?
 
Zurück