Lock wait timeout exceeded; try restarting transaction一些信息

引用自
http://blog.csdn.net/beenin/article/details/5709795

1、锁等待超时。是当前事务在等待其它事务释放锁资源造成的。可以找出锁资源竞争的表和语句,优化你的SQL,创建索引等,如果还是不行,可以适当减少并发线程数。

 

2、你的事务在等待给某个表加锁时超时了,估计是表正被另的进程锁住一直没有释放。

可以用 SHOW INNODB STATUS/G; 看一下锁的情况。

 

3、搜索解决 之道 

在管理 节点的[ndbd default] 
区加: 
TransactionDeadLockDetectionTimeOut=10000(设置 为10秒)默认是1200(1.2秒) 

 

4、

InnoDB会自动的检测死锁进行回滚,或者终止死锁的情况。

引用

InnoDB automatically detects transaction deadlocks and rolls back a transaction or transactions to break the deadlock. InnoDB tries to pick small transactions to roll back, where the size of a transaction is determined by the number of rows inserted, updated, or deleted. 



如果参数innodb_table_locks=1并且autocommit=0时,InnoDB会留意表的死锁,和MySQL层面的行级锁。另外,InnoDB不会检测MySQL的Lock Tables命令和其他存储引擎死锁。 
你应该设置innodb_lock_wait_timeout来解决这种情况。 

innodb_lock_wait_timeout是Innodb放弃行级锁的超时时间。 

猜你喜欢

转载自stevenfeng.iteye.com/blog/1942575