zoukankan      html  css  js  c++  java
  • mysql 死锁问题

    关闭自动提交:
    
    autocommit=0;
    
    SESSION A:
    
    Database changed
    mysql> select * from ProductQuota;
    +-----------+-------------+
    | productSn | frozenQuota |
    +-----------+-------------+
    |       200 |         100 |
    +-----------+-------------+
    1 row in set (0.00 sec)
    
    mysql> select * from test;
    +----+------+
    | id | name |
    +----+------+
    |  1 | a    |
    +----+------+
    1 row in set (0.00 sec)
    
    mysql> update ProductQuota  set frozenQuota='200' where productSn=200;
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> update test set name='b' where id=1;
    ---hang
    
    
    
    SESSION B:
    
    
    mysql>  update test set name='b' where id=1;
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> update ProductQuota  set frozenQuota='200' where productSn=200;
    ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction

  • 相关阅读:
    对象的实例化内存布局与访问定位
    方法区

    虚拟机栈
    运行时数据区
    类加载子系统
    JVM和Java体系架构
    JUnit概述
    HTML5CSS3_day03
    HTML5CSS3_day01
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350872.html
Copyright © 2011-2022 走看看