RR级别
mysql V5.6 debug
set global innodb_purge_stop_now=1;
测试1
会话1:
mysql> create table a( a int primary key,b varchar(30));
Query OK, 0 rows affected (0.04 sec) mysql> insert into a values(1,"a");
Query OK, 1 row affected (0.17 sec) mysql> insert into a values(2,"b");
Query OK, 1 row affected (0.18 sec) mysql> insert into a values(3,"c");
Query OK, 1 row affected (0.01 sec) mysql> insert into a values(4,"d");
Query OK, 1 row affected (0.17 sec) mysql> delete from a where a=3;
Query OK, 1 row affected (0.01 sec) mysql> select * from a;
+---+------+
| a | b |
+---+------+
| 1 | a |
| 2 | b |
| 4 | d |
+---+------+
3 rows in set (0.00 sec) mysql> begin;
Query OK, 0 rows affected (0.17 sec) mysql> select * from a where a<=3 for update;
+---+------+
| a | b |
+---+------+
| 1 | a |
| 2 | b |
+---+------+
2 rows in set (0.01 sec)
会话2:
---TRANSACTION 107908, ACTIVE 65 sec
2 lock struct(s), heap size 376, 4 row lock(s)
MySQL thread id 5, OS thread handle 0x2ab31a1d2940, query id 136 localhost root cleaning up
Trx read view will not see trx with id >= 107909, sees < 107909
TABLE LOCK table `test`.`a` trx id 107908 lock mode IX
RECORD LOCKS space id 240 page no 3 n bits 72 index `PRIMARY` of table `test`.`a` trx id 107908 lock_mode X
Record lock, heap no 2 PHYSICAL RECORD: n_fields 4; compact format; info bits 0
0: len 4; hex 80000001; asc ;;
1: len 6; hex 00000001a575; asc u;;
2: len 7; hex c6000001cd0110; asc ;;
3: len 1; hex 61; asc a;; Record lock, heap no 3 PHYSICAL RECORD: n_fields 4; compact format; info bits 0
0: len 4; hex 80000002; asc ;;
1: len 6; hex 00000001a576; asc v;;
2: len 7; hex c7000002310110; asc 1 ;;
3: len 1; hex 62; asc b;; Record lock, heap no 4 PHYSICAL RECORD: n_fields 4; compact format; info bits 32
0: len 4; hex 80000003; asc ;;
1: len 6; hex 00000001a581; asc ;;
2: len 7; hex 4e000001f618a5; asc N ;;
3: len 1; hex 63; asc c;; Record lock, heap no 5 PHYSICAL RECORD: n_fields 4; compact format; info bits 0
0: len 4; hex 80000004; asc ;;
1: len 6; hex 00000001a57c; asc |;;
2: len 7; hex cb0000016b0110; asc k ;;
3: len 1; hex 64; asc d;;
测试2:
会话1:
mysql> create table a( a int primary key,b varchar(30));
Query OK, 0 rows affected (0.20 sec) mysql> insert into a values(1,"a");
Query OK, 1 row affected (0.02 sec) mysql> insert into a values(2,"b");
Query OK, 1 row affected (0.18 sec) mysql> insert into a values(3,"c");
Query OK, 1 row affected (0.17 sec) mysql> insert into a values(4,"d");
Query OK, 1 row affected (0.19 sec) mysql> begin;
Query OK, 0 rows affected (0.00 sec) mysql> delete from a where a=3;
Query OK, 1 row affected (0.01 sec)
会话2:
mysql> begin;
Query OK, 0 rows affected (0.00 sec) mysql> insert into a select 3,"c";
等待
会话3:
---TRANSACTION 107978, ACTIVE 30 sec inserting
mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 376, 1 row lock(s)
MySQL thread id 8, OS thread handle 0x2ab31a190940, query id 187 localhost root executing
insert into a select 3,"c"
------- TRX HAS BEEN WAITING 30 SEC FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 242 page no 3 n bits 72 index `PRIMARY` of table `test`.`a` trx id 107978 lock mode S locks rec but not gap waiting
Record lock, heap no 4 PHYSICAL RECORD: n_fields 4; compact format; info bits 32
0: len 4; hex 80000003; asc ;;
1: len 6; hex 00000001a5c8; asc ;;
2: len 7; hex 780000018d0d16; asc x ;;
3: len 1; hex 63; asc c;; ------------------
TABLE LOCK table `test`.`a` trx id 107978 lock mode IX
RECORD LOCKS space id 242 page no 3 n bits 72 index `PRIMARY` of table `test`.`a` trx id 107978 lock mode S locks rec but not gap waiting
Record lock, heap no 4 PHYSICAL RECORD: n_fields 4; compact format; info bits 32
0: len 4; hex 80000003; asc ;;
1: len 6; hex 00000001a5c8; asc ;;
2: len 7; hex 780000018d0d16; asc x ;;
3: len 1; hex 63; asc c;; ---TRANSACTION 107976, ACTIVE 79 sec
2 lock struct(s), heap size 376, 1 row lock(s), undo log entries 1
MySQL thread id 5, OS thread handle 0x2ab31a1d2940, query id 184 localhost root cleaning up
TABLE LOCK table `test`.`a` trx id 107976 lock mode IX
RECORD LOCKS space id 242 page no 3 n bits 72 index `PRIMARY` of table `test`.`a` trx id 107976 lock_mode X locks rec but not gap
Record lock, heap no 4 PHYSICAL RECORD: n_fields 4; compact format; info bits 32 //该记录已经删除,但未提交
0: len 4; hex 80000003; asc ;;
1: len 6; hex 00000001a5c8; asc ;;
2: len 7; hex 780000018d0d16; asc x ;;
3: len 1; hex 63; asc c;;
插入一个记录:对该记录加 lock mode S locks rec
删除一条记录:对该记录加lock_mode X locks rec
测试3:
set global innodb_purge_stop_now=1;
mysql> select * from t;
+---+
| a |
+---+
| 1 |
| 3 |
+---+
2 rows in set (0.01 sec) mysql> show create table t; CREATE TABLE `t` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk
mysql> delete from t where a=2;
Query OK, 1 row affected (0.00 sec)
mysql> begin;
Query OK, 0 rows affected (0.01 sec) mysql> select * from t where a=2 for update;
Empty set (0.00 sec)
---TRANSACTION 109372, ACTIVE 16 sec
2 lock struct(s), heap size 376, 1 row lock(s)
MySQL thread id 1, OS thread handle 0x2b2a48081940, query id 37 localhost root cleaning up
TABLE LOCK table `test`.`t` trx id 109372 lock mode IX
RECORD LOCKS space id 248 page no 3 n bits 72 index `PRIMARY` of table `test`.`t` trx id 109372 lock_mode X locks rec but not gap
Record lock, heap no 3 PHYSICAL RECORD: n_fields 3; compact format; info bits 32 //已经删掉了,加了 记录锁
0: len 4; hex 80000002; asc ;;
1: len 6; hex 00000001ab36; asc 6;;
2: len 7; hex 25000001571dd2; asc % W ;;
mysql> rollback;
Query OK, 0 rows affected (0.00 sec) mysql> insert into t select 2;
Query OK, 1 row affected (0.19 sec)
Records: 1 Duplicates: 0 Warnings: 0 mysql> begin;
Query OK, 0 rows affected (0.01 sec) mysql> select * from t where a<3 for update;
+---+
| a |
+---+
| 1 |
| 2 |
+---+
2 rows in set (0.01 sec)
---TRANSACTION 109375, ACTIVE 5 sec
2 lock struct(s), heap size 376, 4 row lock(s)
MySQL thread id 1, OS thread handle 0x2b2a48081940, query id 44 localhost root cleaning up
TABLE LOCK table `test`.`t` trx id 109375 lock mode IX
RECORD LOCKS space id 248 page no 3 n bits 72 index `PRIMARY` of table `test`.`t` trx id 109375 lock_mode X
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
0: len 8; hex 73757072656d756d; asc supremum;; Record lock, heap no 2 PHYSICAL RECORD: n_fields 3; compact format; info bits 0
0: len 4; hex 80000001; asc ;;
1: len 6; hex 00000001ab2f; asc /;;
2: len 7; hex a0000001ea0110; asc ;; Record lock, heap no 3 PHYSICAL RECORD: n_fields 3; compact format; info bits 0 原来的 2已丢失了
0: len 4; hex 80000002; asc ;;
1: len 6; hex 00000001ab3d; asc =;;
2: len 7; hex 29000001ae186e; asc ) n;; Record lock, heap no 4 PHYSICAL RECORD: n_fields 3; compact format; info bits 0
0: len 4; hex 80000003; asc ;;
1: len 6; hex 00000001ab35; asc 5;;
2: len 7; hex a4000001ac0110; asc ;;
purge的更多相关文章
-
UNABLE TO PURGE A RECORD(二)
上一篇文章说明了bug出现的原因和原理分析,要修复bug似乎已经水到渠成了,但远没有这么简单,只因为“并发”.要修复问题,首先要做的第一件事情是稳定的复现问题.由于数据库系统是一个并发系统,并且这个b ...
-
Bug #19528825 ";UNABLE TO PURGE A RECORD";
概述: 在生产环境中,当开启insert buffer时(参数innodb_change_buffering=all),部分实例偶尔会出现“UNABLE TO PURGE A RECORD”错误.这个 ...
-
purge mysql自带命令清除binlog
#!/bin/bash DATAUSER=root DATAPASS=shiyiwen DAY=$1 if [ ! $# == 1 ];then echo -e "\033[32m USAG ...
-
一个purge参数引发的*——从线上hbase数据被删事故说起
在写这篇blog前,我的心情久久不能平静,虽然明白运维工作如履薄冰,但没有料到这么一个细小的疏漏会带来如此严重的灾难.这是一起其他公司误用puppet参数引发的事故,而且这个参数我也曾被“坑过”. ...
-
什么是purge操作
要明白什么清空(purge)操作,你得明白什么是事务的多版本控制,即MVCC(multi-version concurrency control).Innodb为了实现MVCC, 需要在表空间内保存老 ...
-
DROP TABLE ** CASCADE CONSTRAINTS PURGE删除表的时候级联删除从表外键
1.关于 cascade constraints 假设A为主表(既含有某一主键的表),B为从表(即引用了A的主键作为外键). 则当删除A表时,如不特殊说明,则 drop table A 系统会出现错误 ...
-
Using dbms_shared_pool.purge to remove a single task from the library cache
我们都知道可是使用 alter system flush shared_pool 来清除shared pool 信息,当时不能指定清除某个对象.因为在系统繁忙的时侯 使用 alter system f ...
-
手动purge优化器的统计信息与AWR快照,减少对sysaux表空间的占用
1.运行以下脚本,计算当前优化器统计信息和AWR快照表占用sysaux的空间 SQL> conn / as sysdba SQL> @?/rdbms/admin/awrinfo.sql 2 ...
-
purgeIdleCellConnections: found one to purge conn = 0x1e09f7d0
purgeIdleCellConnections: found one to purge conn = 0x1e09f7d0 你在iOS6下使用3G网络时可能会遇到这条log,不用紧张,这只是苹果的工 ...
-
死锁相关 变量 与 PURGE 线程停止
http://www.tuicool.com/articles/NzAFZn https://github.com/percona/percona-server/pull/83/commits/091 ...
随机推荐
-
VS代码片段(snippet)创作工具——Snippet Editor(转)
原文:http://blog.csdn.net/oyi319/article/details/5605502 从Visual Studio 2005开始,IDE支持代码片段.代码片段以代码缩写和TAB ...
-
IT客学院《构建高转化率的着陆页-PS+HTML+网络营销》共25节【价值199元】无水印版
课程简介本课程是全网独家专业的着陆页课程,课程完整的再现了整个着陆页实战案例的开发过程,包括:策划.设计和实现.上线后的推广.优化及提高转化率的技巧等,本套课程能帮助您迅速掌握着陆页的能力,迅速洞察完 ...
-
kernel nf_conntrack: table full, dropping packet[转载]
http://blog.yorkgu.me/2012/02/09/kernel-nf_conntrack-table-full-dropping-packet/ 综合:ip_conntrack就是li ...
-
<;转载>;浅谈C/C++的浮点数在内存中的存储方式
C/C++浮点数在内存中的存储方式 任何数据在内存中都是以二进制的形式存储的,例如一个short型数据1156,其二进制表示形式为00000100 10000100.则在Intel CPU架构的系统中 ...
-
利用ArrayList对Hashtable其进行排序
前言: 最近在使用Hashtable的时候发现一个问题:就是当你对Hashtable进行遍历的时候整个输出结果是毫无顺序的, 上网查了一下说是Hashtable有自己内部的排序机制,如果要自定义排序的 ...
-
JJG 623-2005 电阻应变仪计量检定规程
JJG 623-2005 电阻应变仪计量检定规程 点击下载 JJG533-2007标准模拟应变量校准器检定规程 点击下载 JJG 533-1988标准(里面含有一些更具体的电路图供参考)
-
JBoss快速入门知识
1.下载地址: http://www.jboss.org/jbossas/downloads
-
POJ-3295 Tautology---栈+表达式求值
题目链接: https://vjudge.net/problem/POJ-3295 题目大意: 输入由p.q.r.s.t.K.A.N.C.E共10个字母组成的逻辑表达式WFF 其中 ...
-
【XSY2774】学习 带花树
题目描述 给你一个图,求最大匹配. 边的描述方式很特殊,就是一次告诉你\(c_i\)个点:\(d_1,d_2,\ldots,d_{c_i}\),表示这些点两两之间都有连边,也就是说,这是一个团.总共有 ...
-
WyBox 7620a 启用第二个串口
要修改的文件有两个 mt7620a.dtsi MT7620a.dts 1.进入target/linux/ramips/dts/ mt7620a.dtsi 把”disabled”改为”ok”,添加两行 ...