• mysql 更新唯一主键列 被堵塞


    mysql> select @@tx_isolation;   
    +-----------------+
    | @@tx_isolation  |
    +-----------------+
    | REPEATABLE-READ |
    +-----------------+
    1 row in set (0.00 sec)
    
    Session 196:
    
    mysql> show create table mail;
    +-------
    | mail  | CREATE TABLE `mail` (
      `mailid` bigint(20) NOT NULL AUTO_INCREMENT,
      `receiverid` int(10) unsigned NOT NULL,
      `senderid` int(10) unsigned NOT NULL,
      PRIMARY KEY (`mailid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
    
    
    mysql> insert into mail values(1,2222,3333);
    Query OK, 1 row affected (0.00 sec)
    
    mysql> insert into mail values(2,333,3333);
    Query OK, 1 row affected (0.00 sec)
    
    mysql> commit;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> start transaction;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> insert into mail values(3,333,3333);
    Query OK, 1 row affected (0.00 sec)
    
    mysql> select connection_id(); 
    +-----------------+
    | connection_id() |
    +-----------------+
    |             196 |
    +-----------------+
    1 row in set (0.02 sec)
    
    
    
    Session 197:
    
    
    mysql> update mail set receiverid=193719371 where mailid=3;
    ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
    mysql> update mail set receiverid=193719371 where mailid=3;
    ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
    mysql> select connection_id(); 
    +-----------------+
    | connection_id() |
    +-----------------+
    |             197 |
    +-----------------+
    1 row in set (0.00 sec)
    
    mysql> update mail set receiverid=193719371 where mailid=3;
    
    
    
    
    389253799,197,update mail set receiverid=193719371 where mailid=3,389253798,196,
     mysql[192.168.11.187]   blocking_thread[196] current_query[]  blocking waiting_thread[197]'s update mail set receiverid=193719371 where mailid=3
    ,,,,,
    ,,,,,
    ,,,,,
    ,,,,,
    ,,,,,
    ,,,,,

  • 相关阅读:
    Orcale 之基本术语一
    robots 小记
    划分子网例题详解 转
    jsp中利用response.senddirect(str)重定向,传递参数新思路
    当有多个form表单请求时如何处理?
    Form表单中的action提交路径问题
    用mysql workbench导出mysql数据库关系图
    eclipse中html编辑环境的搭建
    两个jsp文件运行后弹出对话框 下载文件问题
    Eclipse tomcat配置 未在Eclipse中添加.jar包出错
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349971.html
Copyright © 2020-2023  润新知