Description
I am using LockRegistryLeaderInitiator
with JdbcLockRegistry
. It worked fine on 5.6.36 but after the migration to 5.7.19 I noticed flood of "leader granted/revoked" events when more than on instance of my service is running. After some debugging I noticed it is caused by DeadlockLoserDataAccessException
not handled as "retry" in JdbcLockRegistry
.
MySql 5.7.15 introduced setting innodb_deadlock_detect
(enabled by default, see https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_deadlock_detect).
When this setting is enabled exception will be thrown from MySql JDBC driver when deadlock is detected while accessing table row (vendorCode=1213, SQLState=40001, message: Deadlock found when trying to get lock; try restarting transaction). It is then wrapped to spring exception DeadlockLoserDataAccessException
.
JdbcLockRegistry
does not handle DeadlockLoserDataAccessException
with "try again" action (as it does for CannotSerializeTransactionException
, TransactionTimedOutException
, QueryTimeoutException
).
see
Spring Boot 1.5.13.RELEASE
Spring Integration JDBC 4.3.16.RELEASE
MySQL 5.6.36/5.7.19