当前位置:网站首页>MySQL-Multiversion Concurrency Control
MySQL-Multiversion Concurrency Control
2022-08-02 07:50:00 【kk_lina】
I. Concept
mvcc implements database concurrency control through multiple version management of data rows.This technology ensures that consistent read operations are performed under the transaction isolation level of innoDB.It is to query some rows that are being updated by another transaction, and you can see the values before they are updated, so that you do not have to wait for another transaction to release the lock when doing the query.
Second, snapshot read and current read
mvcc is implemented in MySQL InnoDB mainly to improve the concurrent performance of the database, to better handle read-write conflicts, so that even if there are read-write conflicts, no locks can be added, and non-blocking concurrencyRead, this read refers to snapshot read, not current read.The current read is actually a locking operation, the realization of pessimistic locking, and the essence of mvcc is the realization of optimistic locking.
1. Snapshot read (consistent read)
Reads are snapshot data. Simple selects without locks belong to snapshot reads. They may not be the latest data, but may be historical versions. The premise is that the isolation level is not serial.A snapshot read at the row level may degenerate into a current read.
2. Current reading
The current version is read. When reading, it needs to be locked to ensure that the data under a certain transaction will not be modified by other transactions.
Third, MVCC implementation principle of ReadView
1. What is ReadView
Transactions are used to query the historical snapshots stored in the undo log and provide row visibility. Innodb constructs an array for each transaction to record and maintain the ID of the current active transaction in the system (started but stillnot submitted)
2. Design ideas
- Using READ UNCOMMITED isolation level transactions, you can read uncommitted transactions, so MVCC is not used, so the latest data is read without reading historical data;
- Use the SERIALIZABLE isolation level transaction, innodb stipulates the use of locking to access records;
- Transactions using the READ COMMITTED and REPEATABLE READ isolation levels must ensure that the records modified by the committed transaction are read.Adding another transaction has modified the record but has not yet submitted it, so the latest version of the record cannot be directly read. The core problem is to determine which version in the version chain is visible to the current transaction. This is the main problem to be solved by ReadView.
- cread_trx_id: The transaction id that created this read view;
- trx_ids: A list of transaction ids representing the active read and write transactions in the current system when the read view was generated;
- up_limit_id: The smallest transaction id in active transactions;
- low_limit_id: Indicates the id value that should be assigned to the next transaction in the system when the read view is generated.Is the system's largest transaction id.
边栏推荐
- LeetCode 2312. Sell Wood Blocks
- OC-错误提示
- 自然语言处理 文本预处理(下)(张量表示、文本数据分析、文本特征处理等)
- OC - NSSet (set)
- 概率论与数理统计
- 【故障诊断分析】基于matlab FFT轴承故障诊断(包络谱)【含Matlab源码 2002期】
- 查找最大的n个文件
- gdalinfo: error while loading shared libraries: libgdal.so.30: cannot open shared object file: No su
- Agile, DevOps and Embedded Systems Testing
- LeetCode 2360. 图中的最长环
猜你喜欢

MySQL-FlinkCDC-Hudi实时入湖

论文阅读 (64):Weakly-supervised Video Anomaly Detection with Robust Temporal Feature Magnitude Learning

Splunk Field Caculated 计算字段

电商库存系统的防超卖和高并发扣减方案

主流定时任务解决方案全横评

“蔚来杯“2022牛客暑期多校训练营5,签到题KBGHFCD

实例029:反向输出

2022.07.31(LC_6132_使数组中所有元素都等于零)

A Preliminary Study on the Basic Principles of Formal Methods

FaceBook社媒营销高效转化技巧分享
随机推荐
实例031:字母识词
Go 实现分布式锁
LeetCode刷题(7)
Splunk Field Caculated 计算字段
spark架构
实例027:递归输出
张驰咨询:企业实施精益管理的最大障碍,只把精益作为一种工具和方法
hdu1752 copy
MySQL-数据库设计规范
【故障诊断分析】基于matlab FFT轴承故障诊断【含Matlab源码 2001期】
View port number occupancy
实例029:反向输出
电商库存系统的防超卖和高并发扣减方案
在VMware上安装Metasploitable2
CSRF-跨站请求伪造-相关知识
以训辅教,以战促学 | 新版攻防世界平台正式上线运营!
jvm 二之 栈帧内部结构
请教一下,Flink SQL ,JDBC sink 入 mysql 库,想要搞一个自增主键,要怎么写
逆变器绝缘检测检测功能及软件实现
查看僵尸进程