zoukankan      html  css  js  c++  java
  • MySQL 死锁日志分析

    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.   
    19. *** (2) TRANSACTION:  
    20. TRANSACTION 110C, ACTIVE 1716 sec starting index read, thread declared inside InnoDB 500  ## 事务ID=110C,活跃了1716s  
    21. mysql tables in use 1, locked 1  
    22. 3 lock struct(s), heap size 376, 2 row lock(s), undo log entries 1  ## 3个锁,2个行锁,1个undo log  
    23. MySQL thread id 2, OS thread handle 0x7f563c05e700, query id 82 localhost root updating  ## 该事务的线程ID=2  
    24. delete from t1 where a=3   ## 这是当前事务执行的SQL  
    25. *** (2) HOLDS THE LOCK(S):  ## 这个事务持有的锁信息  
    26. 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  
    27. Record lock, heap no 2 PHYSICAL RECORD: n_fields 4; compact format; info bits 32  ## 在主键上的page num=3上已持有一个X锁(not gap),锁80 bits  
    28.  0: len 4; hex 80000001; asc     ;;  
    29.  1: len 6; hex 00000000110c; asc       ;;  
    30.  2: len 7; hex 0d000002350084; asc     5  ;;  
    31.  3: len 4; hex 80000001; asc     ;;  
    32.   
    33. *** (2) WAITING FOR THIS LOCK TO BE GRANTED:  ## 同时这个事务还等待的锁信息  
    34. 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  
    35. Record lock, heap no 3 PHYSICAL RECORD: n_fields 4; compact format; info bits 0  ## 同样等待在主键上的page num=3上有加一个X锁(not gap waiting),锁80 bits  
    36.  0: len 4; hex 80000003; asc     ;;  
    37.  1: len 6; hex 000000000f71; asc      q;;  
    38.  2: len 7; hex ed0000022f0090; asc     /  ;;  
    39.  3: len 4; hex 80000003; asc     ;;  
    40.   
    41. *** WE ROLL BACK TRANSACTION (1)   ## 这里选择回滚了事务110E。  
    42.   
    43. 也就是说,这个死锁使用事务110E中的SQL没有执行,回滚了:  
    44. delete from t1 where a=1  
    45. 而事务110C中的SQL是正常被执行的:  
    46. delete from t1 where a=3  
  • 相关阅读:
    asp.net2.0 Theme and Skin
    Microsoft Exchange Server 2010 介绍
    Visual Studio 2010 Team System 动手实验室
    WCF中的消息契约
    Windows Workflow Foundation实验01——Windows Workflow Foundation 快速入门(练习二)
    C#中Brush、Color、String相互转换
    VS自动生成有参构造函数并自动依赖注入插件
    C#集合已修改:可能无法执行枚举操作
    Docker安装后启动不了,报“参考的对象类型不支持尝试的操作”
    windows下安装Docker超全图文教程
  • 原文地址:https://www.cnblogs.com/hankyoon/p/5169718.html
Copyright © 2011-2022 走看看