环境: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. HTML使用CSS样式的方法

      在html网页中引入css样式表主要有一下四种方法 1.行内引入 <p ></p> 2.嵌入式 <style type="text/css"> ...

  2. 【CF666E】Forensic Examination 广义后缀自动机+倍增+线段树合并

    [CF666E]Forensic Examination 题意:给你一个字符串s和一个字符串集合$\{t_i\}$.有q个询问,每次给出$l,r,p_l,p_r$,问$s[p_l,p_r]$在$t_l ...

  3. nw.js---创建一个点击菜单

    使用nw.js创建一个可点击的菜单: <!doctype html> <html lang="en"> <head> <meta char ...

  4. Nestjs 链接mysql

    文档 下插件 λ yarn add @nestjs/typeorm typeorm mysql 创建 cats模块, 控制器,service λ nest g mo cats λ nest g co ...

  5. elk-图形化展示(八)

    可以根据自己定义: pv: uv: ip top 10 ua tope 10 url top 5 status  top 10 仪表板展示:

  6. ruby离线安装整理

    参考官方文档: https://rvm.io/rvm/offline 参考博客:https://blog.csdn.net/topswim/article/details/79260369 一.前提  ...

  7. CSS斜切角

    问题 斜切角在Web设计和印刷中是相当受欢迎的样式.它通常是在一个或多个元素的角落切一个45°的角(也就是所谓的斜切角).特别是最近,扁平化设计的势头压过了拟真设计,也使这种效果更加流行.当斜切角只存 ...

  8. python全栈开发 * 33 知识点汇总 * 180718

    33 udp协议编码 显示客户端名字,输出带颜色的内容 udp协议的时间同步机制 #一.udp 协议编码 一个服务器,多个客户端#服务器:# import socket# sk=socket.sock ...

  9. VM装mac10.9教程+报错信息解决办法

    VM装mac10.9教程+报错信息解决办法 教程1: 教你在Vmware 10下安装苹果Mac10.9系统 地址:http://tieba.baidu.com/p/2847457021 教程2: VM ...

  10. Codeforces 570E - Pig and Palindromes - [滚动优化DP]

    题目链接:https://codeforces.com/problemset/problem/570/E 题意: 给出 $n \times m$ 的网格,每一格上有一个小写字母,现在从 $(1,1)$ ...