14.5.5 Deadlocks in InnoDB
14.5.5 Deadlocks in InnoDB 14.5.5.1 An InnoDB Deadlock Example
14.5.5.2 Deadlock Detection and Rollback
14.5.5.3 How to Minimize and Handle Deadlocks 死锁是一种情况 不同的事务是不能处理 因为每个持有的lock 是其他会话需要的。 因为所有事务都是等待一个资源变得可用,两者都不释放它持有的锁 一个deadlock 可以发生 当事务锁定记录在多个表(通过语句比如UPDATE or SELECT ... FOR UPDATE), 但是相反的顺序,一个deadlock 也可以发生当语句锁定 index记录的范围和区间, 每个事务需要一些locks. 为了减少死锁的可能,使用事务而不是LOCK TABLES 语句, 让事务插入和更新数据足够小 他们不会唱时间保持打开; 当不同的事务更新多个表或者大量的记录,使用相同的操作顺序(比如SELECT ... FOR UPDATE) 在每个事务 创建索引在列上用于SELECT ... FOR UPDATE and UPDATE ... WHERE 自居。 死锁的可能不受事务隔离的影响,因为事务隔离改变了读操作的行为, 而死锁发生因为是写操作。 如果一个死锁发生,InnoDB检测状态和回滚其中一个事务。 因此, 即使你的应用逻辑是正确的,你必须仍旧处理案例当一个事务必须是重试。 看最新的死锁信息在InnoDB 用户事务,
SHOW ENGINE INNODB STATUS\G;
LATEST DETECTED DEADLOCK
------------------------
2016-10-28 17:59:20 7f4acb87f700
*** (1) TRANSACTION:
TRANSACTION 14917, ACTIVE 3180 sec inserting
mysql tables in use 1, locked 1
LOCK WAIT 5 lock struct(s), heap size 2936, 2 row lock(s), undo log entries 6
MySQL thread id 2, OS thread handle 0x7f4acb8c0700, query id 555 localhost root update
insert into t1 values(10)
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 580 page no 3 n bits 72 index `PRIMARY` of table `zjzc`.`t1` trx id 14917 lock_mode X insert intention waiting
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
0: len 8; hex 73757072656d756d; asc supremum;; *** (2) TRANSACTION:
TRANSACTION 14919, ACTIVE 5 sec inserting
mysql tables in use 1, locked 1
4 lock struct(s), heap size 1184, 2 row lock(s)
MySQL thread id 3, OS thread handle 0x7f4acb87f700, query id 556 localhost root update
insert into t1 values(10)
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 580 page no 3 n bits 72 index `PRIMARY` of table `zjzc`.`t1` trx id 14919 lock mode S
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
0: len 8; hex 73757072656d756d; asc supremum;; *** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 580 page no 3 n bits 72 index `PRIMARY` of table `zjzc`.`t1` trx id 14919 lock_mode X insert intention waiting
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
0: len 8; hex 73757072656d756d; asc supremum;; *** WE ROLL BACK TRANSACTION (2)
14.5.5 Deadlocks in InnoDB的更多相关文章
- 14.3.5.1 An InnoDB Deadlock Example
14.3.5 Deadlocks in InnoDB 14.3.5.1 An InnoDB Deadlock Example 14.3.5.2 Deadlock Detection and Rollb ...
- 14.7.1 Resizing the InnoDB System Tablespace InnoDB 系统表空间大小
14.7.1 Resizing the InnoDB System Tablespace InnoDB 系统表空间大小 这个章节描述如何增加或者减少 InnoDB 系统表空间的大小 增加InnoDB ...
- 14.6.8 Configuring the InnoDB Master Thread IO Rate 配置InnoDB 主线程IO 速率:
14.6.8 Configuring the InnoDB Master Thread IO Rate 配置InnoDB 主线程IO 速率: 主线程 在InnoDB 是一个线程 执行各种任务在后台. ...
- 14.6.3.5 Configuring InnoDB Buffer Pool Flushing
14.6.3.5 Configuring InnoDB Buffer Pool Flushing InnoDB 执行某些任务在后台, 包括脏叶的刷新(那些已经发生改变的pages 但是没有写入到数据文 ...
- 14.6.3.4 Configuring InnoDB Buffer Pool Prefetching (Read-Ahead) 配置InnoDB Buffer pool 预取
14.6.3.4 Configuring InnoDB Buffer Pool Prefetching (Read-Ahead) 配置InnoDB Buffer pool 预取 一个预读请求是一个I/ ...
- 14.6.3.1 The InnoDB Buffer Pool
14.6.3.1 The InnoDB Buffer Pool InnoDB 保持一个存储区域被称为buffer pool 用于cache数据和索引在内存里, 知道InnoDB buffer pool ...
- 14.5.5.1 An InnoDB Deadlock Example 一个InnoDB 死锁实例
14.5.5.1 An InnoDB Deadlock Example 一个InnoDB 死锁实例 下面的例子演示了一个错误可以发生当一个lock 请求会导致一个死锁,例子设计2个客户端,A和B: J ...
- 14.6.7?Limits on InnoDB Tables InnoDB 表的限制
14.6.7?Limits on InnoDB Tables InnoDB 表的限制 警告: 不要把MySQL system tables 从MyISAM 到InnoDB 表. 这是不支持的操作,如果 ...
- 14.1.3 Turning Off InnoDB 关掉InnoDB
14.1.3 Turning Off InnoDB 关掉InnoDB: Oracle 推荐InnoDB 作为首选的存储引擎用于典型的数据库应用,从单用户的wikis到博客, 到高端应用把性能推到极限. ...
随机推荐
- JPA entity versioning (@Version and Optimistic Locking)
详情见: http://www.byteslounge.com/tutorials/jpa-entity-versioning-version-and-optimistic-locking
- python sklearn.linear_model.LinearRegression.score
score(self, X, y, sample_weight=None) 作用:返回该次预测的系数R2 其中R2 =(1-u/v).u=((y_true - y_pred) ** 2).su ...
- Silverlight实用窍门系列:47.Silverlight中元素到元素的绑定,以及ObservableCollection和List的使用区别
问题一:在某一些情况下,我们使用MVVM模式的时候,对于某一个字段(AgeField)需要在前台的很多个控件(A.B.C.D.E)进行绑定,但是如何能够让我们后台字段名改变的时候能够非常方便的改变所有 ...
- (转)ASP.NET QueryString乱码解决问题
正常的情况下,现在asp.net的网站很多都直接使用UTF8来进行页面编码的,这与Javascript.缺省网站的编码是相同的,但是也有相当一部分采用GB2312. 对于GB2312的网站如果直接用j ...
- C#中的委托范例学习
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cons ...
- Object-C — KVO & oc通知
键值观察(KVO)是基于键值编码的一种技术. 利用键值观察可以注册成为一个对象的观察者,在该对象的某个属性变化时收到通知. 被观察对象需要编写符合KVC标准的存取方法,编写键值观察分为以下三步: (1 ...
- PHP 学习笔记 (三)
stream_context_create()函数的用法: $url = "http://www.someweb.com" $context = stream_context_cr ...
- [转]看看国外的javascript题目,你能全部做对吗?
叶小钗 的博客最近都在讨论面试题目 正好以前也看过一篇,就借花献佛拿出来分享一下 http://perfectionkills.com/javascript-quiz/ 附带了自己的理解,答案有争议的 ...
- Problem 1010 - 素数环问题
#include<iostream> #include<string> #include<algorithm> #include<vector> #in ...
- [转] 属性选择器.mark
CSS 2 引入了属性选择器. 属性选择器可以根据元素的属性及属性值来选择元素. 简单属性选择 如果希望选择有某个属性的元素,而不论属性值是什么,可以使用简单属性选择器. 例子 1 如果您希望把包含标 ...