当前位置:网站首页>「中高级试题」:MVCC实现原理是什么?
「中高级试题」:MVCC实现原理是什么?
2022-07-26 13:41:00 【InfoQ】
隐藏字段
- DB_TRX_ID:6字节,最近修改事务id,记录创建这条记录或者最后一次修改该记录的事务id
- DB_ROLL_PTR:7字节,回滚指针,指向这条记录的上一个版本,用于配合undolog,指向上一个旧版本
- DB_ROW_JD:6字节,隐藏的主键,如果数据表没有主键,那么innodb会自动生成一个6字节的row_id

undo log



Read View
- trx_list:一个数值列表,用来维护Read View生成时刻系统正活跃的事务ID(1,2,3)
- up_limit_id:记录trx_list列表中事务ID最小的ID(1)
- low_limit_id:Read View生成时刻系统尚未分配的下一个事务ID,(4)
- 首先比较DB_TRX_ID < up_limit_id,如果小于,则当前事务能看到DB_TRX_ID所在的记录,如果大于等于进入下一个判断
- 接下来判断DB_TRX_ID >= low_limit_id,如果大于等于则代表DB_TRX_ID所在的记录在Read View生成后才出现的,那么对于当前事务肯定不可见,如果小于,则进入下一步判断
- 判断DB_TRX_ID是否在活跃事务中,如果在,则代表在Read View生成时刻,这个事务还是活跃状态,还没有commit,修改的数据,当前事务也是看不到,如果不在,则说明这个事务在Read View生成之前就已经开始commit,那么修改的结果是能够看见的
MVCC的整体处理流程



RC、RR级别下的InnoDB快照读有什么不同?
边栏推荐
- 7-25 0-1 backpack (50 points)
- 时间复杂度和空间复杂度
- AI theory knowledge map 1 Foundation
- Solve the problem that the remote host cannot connect to the MySQL database
- Probability theory and mathematical statistics
- 云智技术论坛工业专场 明天见!
- 银行业客户体验管理现状与优化策略分析
- Control the probability of random winning [C | random]
- The last time I heard about eBay, or the last time
- Frisbee, 2022 "black red" top stream
猜你喜欢

WPS凭什么拒绝广告?

Pytorch学习笔记(一)安装与常用函数的使用

JSON data transfer parameters & date type parameter transfer

Jenkins 中 shell 脚本执行失败却不自行退出

Frisbee, 2022 "black red" top stream

如何构建以客户为中心的产品蓝图:来自首席技术官的建议

This article explains the FS file module and path module in nodejs in detail

Tdsql-c serverless: help start-ups achieve cost reduction and efficiency increase

Unicode文件解析方法及存在问题

We were tossed all night by a Kong performance bug
随机推荐
Research status and pain points of deep learning 3D human posture estimation at home and abroad
The use of asynchronous thread pool in development
Leetcode 2119. number reversed twice
JUC总结
421. Maximum XOR value of two numbers in the array
panic: Error 1045: Access denied for user ‘root‘@‘117.61.242.215‘ (using password: YES)
Tupu 3D visual national style design | collision between technology and culture "cool" spark“
Familiarize you with the "phone book" of cloud network: DNS
JSON data transfer parameters & date type parameter transfer
Team research and development from ants' foraging process (Reprint)
Unicorn, valued at $1.5 billion, was suddenly laid off, and another track was cold?
Exploration on cache design optimization of community like business
从标注好的xml文件中截取坐标点(人脸框四个点坐标)人脸图像并保存在指定文件夹
Pytorch学习笔记(二)神经网络的使用
华为机考 ~ 偏移量实现字符串加密
【着色器实现Overlay重新覆盖变装效果_Shader效果第九篇】
Photoshop(CC2020)未完
上一次听到易趣,还是上一次
图扑 3D 可视化国风设计 | 科技与文化碰撞炫酷”火花“
【Oauth2】五、OAuth2LoginAuthenticationFilter