当前位置:网站首页>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.
边栏推荐
猜你喜欢

张驰课堂:六西格玛测量系统的误差分析与判定

Analysis of GCC compiler technology

在VMware上安装Metasploitable2

以训辅教,以战促学 | 新版攻防世界平台正式上线运营!

FormData上传二进制文件、对象、对象数组

59:第五章:开发admin管理服务:12:MongoDB的使用场景;(非核心数据,数据量比较大的非核心数据,人脸照片等隐私的小文件;)

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

你认同这个观点吗?大多数企业的数字化都只是为了缓解焦虑

责任链模式(Chain Of Responsibility)

逆变器绝缘检测检测功能及软件实现
随机推荐
SQL server 2014 怎么一次性导出多个查询结果?
请教一下,Flink SQL ,JDBC sink 入 mysql 库,想要搞一个自增主键,要怎么写
LeetCode 2360. 图中的最长环
问个问题,我的Flinkcdc已经跑通了,可以监听msql的binlog了,也能发送kafk
【论文精读】Geometric Structure Preserving Warp for Natural Image Stitching
2022.07.31(LC_6132_使数组中所有元素都等于零)
线程的创建方式
实例032:反向输出II
SQL执行顺序
MySQL-慢查询日志
倍福使用AdsRemote组件实现和C#的ADS通讯
PWA 踩坑 - 第一次加载页面后无法获取CacheStorage某些资源
实验8 VLAN综合实验
(2022牛客多校五)D-Birds in the tree(树形DP)
Splunk Filed extraction field interception
图腾柱和推挽电路介绍
自然语言处理 文本预处理(下)(张量表示、文本数据分析、文本特征处理等)
spark读取文件夹数据
MySQL-FlinkCDC-Hudi实时入湖
主流定时任务解决方案全横评