MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction
笔者报错原因:
一次服务调用开启了两个事务
事务1先对表记录A上X锁,开始事务2,等待返回。
事务2要对记录A上S锁,等待,超时回滚报错。
#mysql查看事务,锁等待关系的sql
select * from information_schema.innodb_trx;
select * from information_schema.innodb_lock_waits;
select * from information_schema.innodb_locks;