1. ------------------------
  2. LATEST DETECTED DEADLOCK
  3. ------------------------
  4. 140824  1:01:24
  5. *** (1) TRANSACTION:
  6. TRANSACTION 110E, ACTIVE 73 sec starting index read   ## 事务ID=110E,活跃了73s
  7. mysql tables in use 1, locked 1
  8. LOCK WAIT 3 lock struct(s), heap size 376, 2 row lock(s)  ## 有2个行锁
  9. MySQL thread id 1, OS thread handle 0x7f55ea639700, query id 81 localhost root updating  ## 该事务的线程ID=1
  10. delete from t1 where a=1   ## 这是当前事务执行的SQL
  11. *** (1) WAITING FOR THIS LOCK TO BE GRANTED:  ## 上面SQL等待的锁信息
  12. RECORD LOCKS space id 12 page no 3 n bits 80 index `PRIMARY` of table `test`.`t1` trx id 110E lock_mode X locks rec but not gap waiting
  13. Record lock, heap no 2 PHYSICAL RECORD: n_fields 4; compact format; info bits 32  ## 等待在主键上的page num=3上有加一个X锁(not gap waiting),锁80 bits
  14. 0: len 4; hex 80000001; asc     ;;
  15. 1: len 6; hex 00000000110c; asc       ;;
  16. 2: len 7; hex 0d000002350084; asc     5  ;;
  17. 3: len 4; hex 80000001; asc     ;;
  18. *** (2) TRANSACTION:
  19. TRANSACTION 110C, ACTIVE 1716 sec starting index read, thread declared inside InnoDB 500  ## 事务ID=110C,活跃了1716s
  20. mysql tables in use 1, locked 1
  21. 3 lock struct(s), heap size 376, 2 row lock(s), undo log entries 1  ## 3个锁,2个行锁,1个undo log
  22. MySQL thread id 2, OS thread handle 0x7f563c05e700, query id 82 localhost root updating  ## 该事务的线程ID=2
  23. delete from t1 where a=3   ## 这是当前事务执行的SQL
  24. *** (2) HOLDS THE LOCK(S):  ## 这个事务持有的锁信息
  25. RECORD LOCKS space id 12 page no 3 n bits 80 index `PRIMARY` of table `test`.`t1` trx id 110C lock_mode X locks rec but not gap
  26. Record lock, heap no 2 PHYSICAL RECORD: n_fields 4; compact format; info bits 32  ## 在主键上的page num=3上已持有一个X锁(not gap),锁80 bits
  27. 0: len 4; hex 80000001; asc     ;;
  28. 1: len 6; hex 00000000110c; asc       ;;
  29. 2: len 7; hex 0d000002350084; asc     5  ;;
  30. 3: len 4; hex 80000001; asc     ;;
  31. *** (2) WAITING FOR THIS LOCK TO BE GRANTED:  ## 同时这个事务还等待的锁信息
  32. RECORD LOCKS space id 12 page no 3 n bits 80 index `PRIMARY` of table `test`.`t1` trx id 110C lock_mode X locks rec but not gap waiting
  33. Record lock, heap no 3 PHYSICAL RECORD: n_fields 4; compact format; info bits 0  ## 同样等待在主键上的page num=3上有加一个X锁(not gap waiting),锁80 bits
  34. 0: len 4; hex 80000003; asc     ;;
  35. 1: len 6; hex 000000000f71; asc      q;;
  36. 2: len 7; hex ed0000022f0090; asc     /  ;;
  37. 3: len 4; hex 80000003; asc     ;;
  38. *** WE ROLL BACK TRANSACTION (1)   ## 这里选择回滚了事务110E。
  39. 也就是说,这个死锁使用事务110E中的SQL没有执行,回滚了:
  40. delete from t1 where a=1
  41. 而事务110C中的SQL是正常被执行的:
  42. delete from t1 where a=3

MySQL 死锁日志分析的更多相关文章

  1. MySQL 死锁问题分析

    转载: MySQL 死锁问题分析 线上某服务时不时报出如下异常(大约一天二十多次):"Deadlock found when trying to get lock;". Oh, M ...

  2. MySQL死锁案例分析与解决方案

    MySQL死锁案例分析与解决方案 现象: 数据库查询: SQL语句分析:  mysql. 并发delete同一行记录,偶发死锁.   delete from x_table where id=?   ...

  3. MySQL死锁问题分析及解决方法实例详解(转)

      出处:http://www.jb51.net/article/51508.htm MySQL死锁问题是很多程序员在项目开发中常遇到的问题,现就MySQL死锁及解决方法详解如下: 1.MySQL常用 ...

  4. 基于innodb_print_all_deadlocks从errorlog中解析MySQL死锁日志

    本文是说明如何获取死锁日志记录的,不是说明如何解决死锁问题的. MySQL的死锁可以通过show engine innodb status;来查看,但是show engine innodb statu ...

  5. mysql死锁问题分析

    线上某服务时不时报出如下异常(大约一天二十多次):“Deadlock found when trying to get lock;”. Oh, My God! 是死锁问题.尽管报错不多,对性能目前看来 ...

  6. mysql死锁问题分析(转)

    线上某服务时不时报出如下异常(大约一天二十多次):“Deadlock found when trying to get lock;”. Oh, My God! 是死锁问题.尽管报错不多,对性能目前看来 ...

  7. mysql 慢日志分析

    mysql 调优首先需要找到那些有问题的SQL语句. 怎么找到这些语句呢? mysql 提供了很方便的功能. 1.慢日志 在my.cnf 文件中,增加如下配置 log-error            ...

  8. MySQL二进制日志分析-代码实现(FORMAT_DESCRIPTION_EVENT)

    如前文概述,MySQL Binlog v3以前版本, 二进制日志文件的第一个事件是START_EVENT_V3, 从v4版本开始第一个事件为FORMAT_DESCRIPTION_EVENT(以下简称F ...

  9. MySQL死锁原因分析

    行级锁有三种模式: innodb 行级锁 record-level lock大致有三种:record lock, gap lock and Next-KeyLocks. record lock  锁住 ...

随机推荐

  1. python 基础——私有属性

    私有属性 python 私有属性以两个下划线开头. python 私有属性只能在类内部访问,类外面访问会出错. python 私有属性之所以不能在外面直接通过名称来访问,其实质是因为 python 做 ...

  2. CF 107E 多边形面积并

    107E Darts 题目:给出n个矩形,问落在n个矩形交的部分的概率 分析:裸的多边形面积并. 代码略..

  3. MVC中Jqgrid的用法

    Jqgrid可以接受的数据源格式通常是local.json.string等,而我们通过MVC Controller查询数据库(Linq)通常转化为tolist(),例如: public object ...

  4. CSS导航指示箭头

    效果图 代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. ...

  5. 每天一道LeetCode--371. Sum of Two Integers

    alculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Examp ...

  6. DDL、DML和DCL的理解

    一.DDL  1.DDL的概述       DDL(Data Definition Language 数据定义语言)用于操作对象和对象的属性,这种对象包括数据库本身,以及数据库对象,像:表.视图等等, ...

  7. sql语句添加约束

    sql语句添加约束 --主键约束(Primary Key constraint):要求主键列的数据唯一,并且不允许为空. --唯一约束(Unique Constraint):要求该列唯一,允许为空,但 ...

  8. 解析Path方法备忘

    public static String parseDataPath(String dataPath){ StringBuilder parseBld = new StringBuilder(); L ...

  9. nyoj_t218(Dinner)

    描述 Little A is one member of ACM team. He had just won the gold in World Final. To celebrate, he dec ...

  10. UILabel常用属性

    [super viewDidLoad]; // 实例化UILabel并指定其边框 UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0 ...