`

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放弃行级锁的超时时间。 

分享到:
评论

相关推荐

    Java常见异常集-Java,Hibernate,Tomcat异常

    12. **Lock wait timeout exceeded try restarting transaction**:在MySQL中,如果事务等待锁的时间超过设定的超时时间,会出现此错误。分析事务逻辑,优化事务粒度,或者提高锁等待超时时间(innodb_lock_wait_...

    记一次MySQL数据库问题排查

    `Error: ER_LOCK_WAIT_TIMEOUT: Lock wait timeout exceeded; try restarting transaction`表明某个事务在等待其他事务释放锁资源时超过了预设的超时时间。事务是数据库操作的重要组成部分,它确保了数据的一致性和...

    Mysql悲观锁和乐观锁的使用示例

    如果session1长时间不提交,session2将等待锁超时(默认超时时间可通过`innodb_lock_wait_timeout`配置),并抛出错误`(1205, ‘Lock wait timeout exceeded; try restarting transaction`)。通过`show status like ...

    查找MySQL线程中死锁的ID的方法

    当发生死锁时,数据库会检测到这种情况并抛出错误,如错误1205(HY000):“Lock wait timeout exceeded; try restarting transaction”。为了解决这个问题,我们需要找出导致死锁的具体线程并结束它。本文将详细...

    BURNINTEST--硬件检测工具

    A 2 minute timeout has been added to the collection of system information. - Video playback, Hard disk and CD/DVD test 'no operations' error reporting changed. - When BurnInTest crashes, it will ...

Global site tag (gtag.js) - Google Analytics