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. jQuery的deferred对象详解(二)

    Deferred对象是由$.Deferred构造的,$.Deferred被实现为简单的工厂模式. $.Deferred的实现 创建三个$.Callbacks对象,分别表示成功done,失败fail,处 ...

  2. Python 标准库 urllib2 的使用细节[转]

    转自[http://zhuoqiang.me/python-urllib2-usage.html] Python 标准库中有很多实用的工具类,但是在具体使用时,标准库文档上对使用细节描述的并不清楚,比 ...

  3. GSS7 spoj 6779. Can you answer these queries VII 树链剖分+线段树

    GSS7Can you answer these queries VII 给出一棵树,树的节点有权值,有两种操作: 1.询问节点x,y的路径上最大子段和,可以为空 2.把节点x,y的路径上所有节点的权 ...

  4. 写入数据到Plist文件中时,第一次要创建一个空的数组,否则写入文件失败

    #pragma mark - 保存数据到本地Plist文件中 - (void)saveValidateCountWithDate:(NSString *)date count:(NSString *) ...

  5. Unity之屏幕画线

    using UnityEngine;using System.Collections; public class DrawRectangle : MonoBehaviour { public Colo ...

  6. 基于jquery的inputlimiter 实现字数限制功能

    html代码: <td>内容摘要:</td> <td> <textarea id="content_summary" rows=5 nam ...

  7. 解决Toad for Oracle显示乱码问题

    1.查看一下数据库字符集: 使用下面语句:Select userenv('language') from dual;或者:Select name, value$ from props$;查看. 查看完 ...

  8. Linux下动态共享库加载及使用详解【转】

    原文地址:http://blog.chinaunix.net/uid-29025972-id-3855500.html 对动态库的实际应用还不太熟悉的读者可能曾经遇到过类似“error while l ...

  9. javascript构造函数小记

    function outer(){ function inner(){} return inner; } var a=outer(); var b=outer(); var c=new outer() ...

  10. 汇编中PTR常见的几种用法

    汇编中PTR的用法确实是令人比较头疼的,我特意搜集了一些PTR的应用实例,可以从例子中揣摩出规律: 1.MOV    WORD PTR [DI],OFFSET BUF1 2.SUB    BYTE   ...