环境: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. linux查找并替换命令

     find ./ -maxdepth 3 -type f -name "*Makefile"  |xargs sed -i "s/CXX = g++/CXX = ccac ...

  2. 从0移植uboot(六) _实现网络功能

    为uboot添加网卡功能可以让uboot通过tftp下载内核, 方便我们的开发, 对于网卡功能的移植,我们依然在在一遍又一遍的实践这个uboot改造的套路. 找运行逻辑,即插入代码的位置. 根据运行逻 ...

  3. C# 网络爬虫利器之Html Agility Pack如何快速实现解析Html

    简介 现在越来越多的场景需要我们使用网络爬虫,抓取相关数据便于我们使用,今天我们要讲的主角Html Agility Pack是在爬取的过程当中,能够高效的解析我们抓取到的html数据. 优势 在.NE ...

  4. JDK线程池的拒绝策略

    关于新疆服务请求未带入来话原因的问题 经核查,该问题是由于立单接口内部没有成功调用接续的 “更新来电原因接口”导致的,接续测更新来电原因接口编码:NGCCT_UPDATESRFLAG_PUT ,立单接 ...

  5. DATEADD日期函数的使用

    在当前日期加上几天:https://www.cnblogs.com/shitaotao/p/7648198.html 计算本月的第一天:https://www.cnblogs.com/lcyuhe/p ...

  6. openERP笔记 自定义模块开发

    ##需求描述 输入和查询课程,把信息储存到课程对象里 课程包含以下信息:名称,价格,天数,开始日期,教师,学员 每个课程可以有多个学员,要记录学员的姓名.电话.电子邮件 课程可以添加教材和作业等文档附 ...

  7. 图->最短路径->多源最短路径(弗洛伊德算法Floyd)

    文字描述 求每一对顶点间的最短路径,可以每次以一个顶点为源点,重复执行迪杰斯特拉算法n次.这样,便可求得每一对顶点之间的最短路径.总的执行时间为n^3.但是还有另外一种求每一对顶点间最短路径的方法,就 ...

  8. SpringBoot-性能优化之扫包优化

    性能优化 组件自动扫描带来的问题 默认情况下,我们会使用 @SpringBootApplication 注解来自动获取应用的配置信息,但这样也会给应用带来一些副作用.使用这个注解后,会触发自动配置( ...

  9. python 控制语句基础---->代码块:以为冒号作为开始,用缩进来划分作用域,代表一个整体,是一个代码块,一个文件(模块)也称为一个代码块 | 作用域:作用的范围

    # ### 代码块:以为冒号作为开始,用缩进来划分作用域,代表一个整体,是一个代码块,一个文件(模块)也称为一个代码块 # ### 作用域:作用的范围 print(11) print(12) prin ...

  10. sap 软件架构

    1: