The ReadView mechanism is a read view mechanism based on the undo log version chain. Each transaction will generate a ReadView
If it is updated by the transaction itself Data, you can read
or the value modified by the transaction submitted before you generated
ReadView
, or you can readBut if you generate ReadView, there is already an active transaction, but if it modifies the data and submits it after you generate ReadView, you cannot read it at this time
Or if you generate
ReadView
and then open a transaction that modifies the data and submits it, it cannot be read
, so the above mechanism is ReadView
How to implement RC based on ReadView? Core design: When a transaction sets RC, it will regenerate a ReadView every time it initiates a query!
There is a row of data in the database, which is a transaction with transaction id=50. It was inserted a long time ago. The current active transaction is:
Transaction A (id=60)
Transaction B (id=70)
Now transaction B initiates an update to update this data is b, so at this time the trx_id of the data will become the id=70 of transaction B, and an undo log will be generated at the same time:
At this time, transaction A will be initiated A query operation will generate a ReadView
At this time, transaction A initiates a query and finds that the trx_id=70 of the current piece of data. That is, it belongs to the transaction ID range of ReadView, which means that there was this active transaction before it generated ReadView. It was this transaction that modified the value of this data, but transaction B has not yet been submitted at this time, so the m_ids active transaction list of ReadView Here, there are two IDs [60, 70]. At this time, according to the ReadView
mechanism, transaction A cannot find the value b modified by transaction B.
Then search down the undo log version chain, and you will find an original value. You will find that its trx_id is 50, which is smaller than the min_trx_id in the current ReadView. This means that there was a transaction inserted before he generated the ReadView. This value has been obtained and submitted long ago, so the original value can be found.
Assume that transaction B has committed, which means it is no longer an active transaction in the database. The next time transaction A queries, it can read the modified value of transaction B. So how can transaction A be able to read the modified value of submitted transaction B?
Let transaction A initiate a query next time and generate a ReadView. The only active transaction in the database is transaction A, so:
min_trx_id
is 60mac_trx_id
is 71##m_ids=60
, Transaction B's id=70 will not appear in the
m_idsactive transaction list
The above is the detailed content of How MySQL implements RC transaction isolation. For more information, please follow other related articles on the PHP Chinese website!

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于架构原理的相关内容,MySQL Server架构自顶向下大致可以分网络连接层、服务层、存储引擎层和系统文件层,下面一起来看一下,希望对大家有帮助。

在mysql中,可以利用char()和REPLACE()函数来替换换行符;REPLACE()函数可以用新字符串替换列中的换行符,而换行符可使用“char(13)”来表示,语法为“replace(字段名,char(13),'新字符串') ”。

方法:1、利用right函数,语法为“update 表名 set 指定字段 = right(指定字段, length(指定字段)-1)...”;2、利用substring函数,语法为“select substring(指定字段,2)..”。

mysql的msi与zip版本的区别:1、zip包含的安装程序是一种主动安装,而msi包含的是被installer所用的安装文件以提交请求的方式安装;2、zip是一种数据压缩和文档存储的文件格式,msi是微软格式的安装包。

转换方法:1、利用cast函数,语法“select * from 表名 order by cast(字段名 as SIGNED)”;2、利用“select * from 表名 order by CONVERT(字段名,SIGNED)”语句。

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于MySQL复制技术的相关问题,包括了异步复制、半同步复制等等内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了mysql高级篇的一些问题,包括了索引是什么、索引底层实现等等问题,下面一起来看一下,希望对大家有帮助。

在mysql中,可以利用REGEXP运算符判断数据是否是数字类型,语法为“String REGEXP '[^0-9.]'”;该运算符是正则表达式的缩写,若数据字符中含有数字时,返回的结果是true,反之返回的结果是false。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Dreamweaver Mac version
Visual web development tools
