Handled unhandled deadlock case for MySQL

Affects issues:
- Fixed #1383
This commit is contained in:
Risto Lahtela 2020-05-03 19:02:54 +03:00
parent 4fc565913c
commit 2f282dc7cc

View File

@ -87,7 +87,7 @@ public abstract class Transaction {
int errorCode = statementFail.getErrorCode();
boolean mySQLDeadlock = dbType == DBType.MYSQL && errorCode == 1213;
boolean h2Deadlock = dbType == DBType.H2 && errorCode == 40001;
boolean deadlocked = mySQLDeadlock || h2Deadlock;
boolean deadlocked = mySQLDeadlock || h2Deadlock || statementFail instanceof SQLTransactionRollbackException;
if (deadlocked && attempts < ATTEMPT_LIMIT) {
executeTransaction(db); // Recurse to attempt again.
return;