环境: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. HOOK IDT频繁蓝屏(Window 正确 HOOK IDT)

    环境 win7x64 Microsoft Windows [版本 6.1.7601]也是一个朋友 HOOK IDT 测试 问我IDT为啥老是蓝屏.结果是因为swapgs问题. 如果你知道swapgs作 ...

  2. zhenya moves from parents

    Zhenya moved from his parents' home to study in other city. He didn't take any cash with him, he onl ...

  3. 深入理解Java虚拟机(笔记)

    内存分配: 为对象分配内存有两种方式,第一种是“指针碰撞”,也就是把内存分为两边,一边是已使用区域,另一边是未分配区域,分界线用指针记录,当要分配内存时,只需把指针向未分配区域移动需要的空间即可,通常 ...

  4. vue 拍照上传图片 demo

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. MongoDB数据导出

    在bin目录下(没有设置环境变量), mongoexport -d Structure_Patents_infos -c patents_texts -o D:\Postgraduate\Python ...

  6. spring 开始构造

    1,选择“org.apache.maven.archetypes:maven-archetype-webapp”骨架(模板),创建一个Web项目: 在main 目录下创建文件夹  java,  res ...

  7. ionic3 创建项目至apk打包全过程教程

    主要流程: 安装node.js  -->  安装jdk  -->  安装AndroidSDK  -->  安装cordova  -->  安装ionic -->  创建项 ...

  8. U盘出现很多.exe的文件处理方案

    1.原来优盘显示隐藏系统文件后,会有MyDocument文件夹和MyDocument.exe文件两个. 2.在MyDocument文件夹下新建文件夹名为“安全区”的空文件夹. 3.在U盘的根目录下新建 ...

  9. 基于Enterprise Architect完成数据库建模

    基于Enterprise Architect完成数据库建模 “工欲善其事必先利其器”,Enterprise Architect是一款非常便利的设计工具,目前我也是刚刚使用没多久,进行过系统设计.UML ...

  10. (转载)Java Map中的Value值如何做到可以为任意类型的值

    转载地址:http://www.importnew.com/15556.html     如有侵权,请联系作者及时删除. 搬到我的博客来,有空细细品味,把玩. 本文由 ImportNew - shut ...