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到博客, 到高端应用把性能推到极限. ...
随机推荐
- android js 互调
public class BoatsActivity extends Activity { Handler mHandler = new Handler();//处理消息的handler @Suppr ...
- WPF加载Winform窗体时 报错:子控件不能为顶级窗体
一.wpf项目中引用WindowsFormsIntegration和System.Windows.Forms 二.Form1.Designer.cs 的 partial class Form1 设置为 ...
- RedHat7笔记
第一章 管理网络 查看网络信息 显示网卡状态# nmcli dev status列出所有连接# nmcli con show只列出可用连接# nmcli con show --active显示网卡配 ...
- .NET 操作PDF文档以及PDF文件打印摸索总结
关于生成 PDF 的操作,相信大家的在实际的工作过程中难免会碰到.以前我们通过生成 word 文档来进行文件的打印,但是由于太过依赖 office 软件,因此尝试能不能使用 PDF 进行文件打印. 在 ...
- matlab中max的用法
C = max(A) 返回一个数组各不同维中的最大元素.如果A是一个向量,max(A)返回A中的最大元素.如果A是一个矩阵,max(A)将A的每一列作为一个向量,返回一行向量包含了每一列的最大元素. ...
- 文件上传利器SWFUpload使用指南
这里就不再介绍什么是SWFUpload啦,简单为大家写一个简单关于SWFUpload的Demo. 1.把SWFUpload 相关的文件引用进来 2.创建upload.aspx页面(页面名称可自定义), ...
- java常用正则表达式
1.邮编 public static final String POSTAL_CODE = "^\\d{6}$"; 2. email(支持中文域名邮箱) 正则表达式 public ...
- ios动力特效,最重要的一点 属性保持(写了动力特效但是没效果的原因就在这里)
@property (nonatomic, strong) UIDynamicItemBehavior *square1PropertiesBehavior; @property (nonatomic ...
- 【转】Objective-C中的instancetype和id关键字
原文:http://blog.csdn.net/wzzvictory/article/details/16994913 一.什么是instancetype instancetype是clang 3.5 ...
- jQuery分析(2) - $工厂函数分析
前言 从这节进入jQuery的世界,首先从jQuery的入口函数开始了解jQuery()或$是如何运作的,这里我给出了一个最小的例子来分析. 回忆 在进入分析代码前我们回想下jQuery的使用方法有哪 ...