All consistent reads within the same transaction read the snapshot established by the first read.
Session 1: Session 2: mysql> show variables like '%tx_isolation%';
+---------------+-----------------+
| Variable_name | Value |
+---------------+-----------------+
| tx_isolation | REPEATABLE-READ |
+---------------+-----------------+
1 row in set (0.00 sec) Session 1: mysql> select * from t100; --看到的记录为291 mysql> update t100 set free = free -quota where sn=10; | 10 | 300 | 1 | 291 | Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0 mysql> commit;
Query OK, 0 rows affected (0.01 sec) mysql> select * from t100;
+----+------+-------+------+
| sn | id | quota | free |
+----+------+-------+------+
| 1 | 7 | NULL | NULL |
| 2 | 9 | NULL | NULL |
| 3 | 990 | NULL | NULL |
| 4 | 12 | NULL | NULL |
| 5 | 13 | NULL | NULL |
| 6 | 14 | NULL | NULL |
| 7 | 15 | NULL | NULL |
| 8 | 22 | NULL | NULL |
| 9 | 23 | NULL | NULL |
| 10 | 300 | 1 | 291 |
+----+------+-------+------+
10 rows in set (0.00 sec) mysql> update t100 set free = free -quota where sn=10; Session 2看到的仍旧是291
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0 mysql> commit;
Query OK, 0 rows affected (0.01 sec) mysql> select * from t100;
+----+------+-------+------+
| sn | id | quota | free |
+----+------+-------+------+
| 1 | 7 | NULL | NULL |
| 2 | 9 | NULL | NULL |
| 3 | 990 | NULL | NULL |
| 4 | 12 | NULL | NULL |
| 5 | 13 | NULL | NULL |
| 6 | 14 | NULL | NULL |
| 7 | 15 | NULL | NULL |
| 8 | 22 | NULL | NULL |
| 9 | 23 | NULL | NULL |
| 10 | 300 | 1 | 290 |
+----+------+-------+------+ RR模式下 以第一次读为准 All consistent reads within the same transaction read the snapshot established by the first read. 所有的一致性读 在相同事务读取快照 有第一次读创建
All consistent reads within the same transaction read the snapshot established by the first read.的更多相关文章
- MySQL 5.6 Reference Manual-14.3 InnoDB Transaction Model and Locking
14.3 InnoDB Transaction Model and Locking 14.3.1 InnoDB Lock Modes 14.3.2 InnoDB Record, Gap, and Ne ...
- MySQL 一致性读 深入研究
一致性读,又称为快照读.使用的是MVCC机制读取undo中的已经提交的数据.所以它的读取是非阻塞的. 相关文档:http://dev.mysql.com/doc/refman/5.6/en/innod ...
- MySQL 一致性读 深入研究 digdeep博客学习
http://www.cnblogs.com/digdeep/p/4947694.html 一致性读,又称为快照读.使用的是MVCC机制读取undo中的已经提交的数据.所以它的读取是非阻塞的. 相关文 ...
- Mysql rr和rc隔离
REPEATABLE READ This is the default isolation level for InnoDB. For consistent reads, there is an im ...
- Mysql加锁过程详解(7)-初步理解MySQL的gap锁
Mysql加锁过程详解(1)-基本知识 Mysql加锁过程详解(2)-关于mysql 幻读理解 Mysql加锁过程详解(3)-关于mysql 幻读理解 Mysql加锁过程详解(4)-select fo ...
- MySQL--事务隔离级别RR和RC的异同
在MySQL中,事务隔离级别RC(read commit)和RR(repeatable read)两种事务隔离级别基于多版本并发控制MVCC(multi-version concurrency con ...
- mysql 锁2
官网地址 https://dev.mysql.com/doc/refman/5.5/en/innodb-transaction-isolation-levels.html 这里主要是说事务隔离级别,以 ...
- MySQL Gap Lock问题
四种隔离级别说明 隔离级别 脏读(Dirty Read) 不可重复读(NonRepeatable Read) 幻读(Phantom Read) 未提交读(Read uncommitted) 可能 可能 ...
- MySQL Transaction--RC和RR区别
在MySQL中,事务隔离级别RC(read commit)和RR(repeatable read)两种事务隔离级别基于多版本并发控制MVCC(multi-version concurrency con ...
随机推荐
- 我的Python成长之路---第一天---Python基础(1)---2015年12月26日(雾霾)
2015年12月26日是个特别的日子,我的Python成之路迈出第一步.见到了心目中的Python大神(Alex),也认识到了新的志向相投的伙伴,非常开心. 尽管之前看过一些Python的视频.书,算 ...
- 如何判断是否安装了VC RUNTIME
先得说下GUID,它是Globally Unique Identifier的简称,中文翻译为“全球唯一标示符”,在Windows系统中也称之为Class ID,缩写为CLSID.对于不同的应用程序,文 ...
- 开源OCR光学字符识别
纸张在 许多地方已日益失宠,无纸化办公谈论40多年,办公环境正限制纸山的生成.而过去几年,无纸化办公的概念发生了显着的转变.在计算机软件的帮助 下,包含大量重要管理数据和资讯的文档可以更方便的以电子形 ...
- Oracle undo 镜像数据探究
Oracle undo 镜像数据探究 今天是2013-08-18,隔别一周的 ...
- windows安装Apache,注册服务出现“(OS 5)拒绝访问。 : AH00369: Failed to open the WinNT service manager..."错误
原文:http://blog.csdn.net/jaray/article/details/9950211 在安装Apache的时候,我下载的是zip格式,不是msi安装版,需要自己注册服务,才能在桌 ...
- 查询SystemFeature的方法
查询SystemFeature的方法可以在adb shell下敲如下的命令: dumpsys package 然后搜feature关键字. 例如,我的平台的SystemFeature,如下所示: Fe ...
- c语言,动态数组
试着直接malloc一个2*3*4的空间来模拟数组: #include <stdio.h> #include <malloc.h> int main(void) { int** ...
- WS_EX_TOOLWINDOW 属性的陷阱
WS_EX_TOOLWINDOW,带有这个属性的窗口有以下特点: 1. 不在任务栏显示. 2. 不显示在Alt+Tab的切换列表中. 3. 在任务管理器的窗口管理Tab中不显示. 我们可能会出于某种目 ...
- UPC 2959: Caoshen like math 这就是个水题
http://acm.upc.edu.cn/problem.php?id=2959 这就是个水题,之所以要写这个题是感觉很有纪念意义 用力看就是盲……23333333333333333 这个题就是最小 ...
- google浙大招聘笔试题 师兄只能帮你到这儿了
google浙大招聘笔试题 一.单选1.80x86中,十进制数-3用16位二进制数表示为?00100002.假定符号-.*.$分别代表减法.乘法和指数运算,且 1)三个运算符优先级顺序是:-最高,*其 ...