环境:Percona Server for MySQL 5.5.18

模拟三个Terminal,实现当引用锁定表的查询被杀死时,错误日志中出现的Got error -1 when reading table

Terminal A

mysql> set session autocommit=0;
Query OK, 0 rows affected (0.00 sec) mysql> create table t1(i1 int not null primary key, v2 varchar(20)) engine =innodb;
Query OK, 0 rows affected (0.00 sec) mysql> insert into t1 values(1,'a'),(2, 'b'),(3, 'c'),(4,'d');
Query OK, 4 rows affected (0.00 sec)
Records: 4 Duplicates: 0 Warnings: 0 mysql> commit;
Query OK, 0 rows affected (0.01 sec) mysql> select * from t1 where i1 = 2 for update;
+----+------+
| i1 | v2 |
+----+------+
| 2 | b |
+----+------+
1 row in set (0.00 sec) mysql> select * from t1 where i1 = 4 for update;
+----+------+
| i1 | v2 |
+----+------+
| 4 | d |
+----+------+
1 row in set (0.00 sec)

Terminal B

mysql> set session autocommit=0;
Query OK, 0 rows affected (0.00 sec) mysql> select * from t1 where i1 = 4 for update; 此时的查询会因为 Terminal A未提交而等待

Terminal C

mysql> show processlist;
+----+------+-----------+------+---------+------+------------+------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+------+---------+------+------------+------------------------------------------+
| 1 | root | localhost | test | Query | 6 | statistics | select * from t1 where i1 = 4 for update |
| 3 | root | localhost | NULL | Query | 0 | NULL | show processlist |
| 5 | root | localhost | test | Sleep | 328 | | NULL |
+----+------+-----------+------+---------+------+------------+------------------------------------------+
3 rows in set (0.00 sec) mysql> kill query 1;  杀掉Terminal B 的Query
Query OK, 0 rows affected (0.00 sec) 查看日志
171111 0:17:04 [ERROR] Got error -1 when reading table './test/t1'

Got error -1 when reading table的更多相关文章

  1. msyql error: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

    mysql> use mydb Reading table information for completion of table and column names You can turn o ...

  2. MySql Error: Can't update table in stored function/trigger

    MySql Error: Can't update table in stored function/trigger because it is already used by statement w ...

  3. ERROR 1114 (HY000): The table 'adv_date_tmp' is full(Mysql临时表应用)

    场景:需要对现在数据库的数据进行批量的进行is_del=1的操作,但是遇到一个问题,在执行sql的时候发现sql不能在查询特定表的时候再嵌套查询来做update的操作,经过讨论,后续我们想到用临时表的 ...

  4. Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -

    mysql -A不预读数据库信息(use dbname 更快)—Reading table information for completion of table and column names Y ...

  5. 解决:Reading table information for completion of table and column names

    mysql -A不预读数据库信息(use dbname 更快)—Reading table information for completion of table and column names Y ...

  6. mysqldump: Got error: 1066: Not unique table/alias

    mysqldump: Got error: 1066: Not unique table/alias myql 导出时提示如下: [root@localhost mysql]# mysqldump  ...

  7. Reading table information for completion of table and column names

    mysql> use ad_detail_page;Reading table information for completion of table and column namesYou c ...

  8. mysql切换数据库提示警告:Reading table information for completion of table and column names

    登录数据库后,选择数据库时发现以下提示, mysql> use testReading table information for completion of table and column ...

  9. MySQL Reading table information for completion of table and column names

    打开数据库是发现提示: mysql> show databases; +--------------------+ | Database | +--------------------+ | b ...

随机推荐

  1. ios12 siri 语音识别

    原理:先用系统的录音器录音,让后让siri识别语音转文字 第一步 :在项目plist文件添加授权如图 第二步:导入头文件,添加协议#import <Speech/Speech.h>#imp ...

  2. nginx配置-为没有后缀的文件(实际上是有html文件)以html形式打开

    location ~ index.php@ { add_header content-type "text/html"; }

  3. python语法_变量及命名规则

    变量:存储信息的,日后被调用,修改操作 常量:固定不变的量,字母大写 变量命名规则: 1 有字母,数字以及下划线等符号组成 2 区分大小写 3 不能使用数字开头,不能含有特殊字符和空格 4 不能使用 ...

  4. python全栈开发 * 23 面向对象 知识点汇总 * 180704

    23 面向对象 -----特殊方法 1. isinstance(obj,类名) 判断对象是否是此类实例化或者此类的子类实例化出来的class A:passclass B(A):passb1=B()pr ...

  5. 求最小生成树的kruskal算法

    连通无向图有最小生成树,边权从小到大排序,每次尝试加入权最小的边,如果不成圈,就把这边加进去,所有边扫一遍就求出了最小生成树. 判断连通分支用Union-Set(并查集),就是把连通的点看成一个集合, ...

  6. linux --- 部署前后端分离项目

    vue + uwsgi +nginx 部署前后端分离项目 准备项目 1.将前端vue项目包和后端django项目包上传服务器,通过lrzsz,直接从windows拖进linux中 2.解压缩操作 前端 ...

  7. spring 总结

    控制反转(Inversion of Control) 依赖注入(Dependency Injection) 一.控制反转 1.控制:传统的方式是由程序创建的,写死的, spring 是由spring管 ...

  8. 使用iostat查看磁盘使用情况

    Ⅰ.iostat安装 [root@VM_42_63_centos ~]# yum install -y sysstat Ⅱ.玩一手 [root@VM_42_63_centos ~]# iostat - ...

  9. iOS NSCache缓存类的了解

    前言:   最近面试时,问到了限定并发数的视频下载,当时回答的时通过GCD_barrier 处理,回来想想也可以通过NSCache处理,所以顺便复习一下,这个知识点. 一,关于NSCache说明 说明 ...

  10. [math] sagemath

    官网首页:http://www.sagemath.org 首页里引出的两个教程 http://www.gregorybard.com/Sage.html http://sagebook.gforge. ...