I'm struggelig with a problem related to handeling deadlocks.
In a PHP script I do a lot of updates to different InnoDb tables. Basically I do:
START TRANSACTION
do several SELECT, INSERT, DELETE and UPDATES
SAVEPOINT an_identifier
DELETE ...
INSERT ...
RELEASE SAVEPOINT
more SELECT, INSERT, DELETE AND UPDATES
COMMIT
Sometime I get a deadlock when doing the DELETE statement right after the SAVEPOINT. And sometime it seems like only the DELETE statement is rolled back, but other times after the START TRANSACTION is rolled back.
So my question is, when a deadlock is detected inside/after a SAVEPOINT has been set, should not the rollback done by MySQL be to the start of the SAVEPOINT?
Have I missed something?
In a PHP script I do a lot of updates to different InnoDb tables. Basically I do:
START TRANSACTION
do several SELECT, INSERT, DELETE and UPDATES
SAVEPOINT an_identifier
DELETE ...
INSERT ...
RELEASE SAVEPOINT
more SELECT, INSERT, DELETE AND UPDATES
COMMIT
Sometime I get a deadlock when doing the DELETE statement right after the SAVEPOINT. And sometime it seems like only the DELETE statement is rolled back, but other times after the START TRANSACTION is rolled back.
So my question is, when a deadlock is detected inside/after a SAVEPOINT has been set, should not the rollback done by MySQL be to the start of the SAVEPOINT?
Have I missed something?