InnoDB deadlocks roll back the whole victim transaction
An InnoDB deadlock occurs when transactions form a cycle of incompatible lock requests. With deadlock detection enabled, InnoDB chooses a victim and rolls back that entire transaction so another participant can proceed. The application receives error 1213 with SQLSTATE 40001. Retrying only the statement that reported the error omits earlier work that was rolled back with it. ...