In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail about mysql solution can not be repeated reading method, Xiaobian think quite practical, so share to everyone for a reference, I hope you can read this article after harvest.
mysql solution can not be repeated read method: the use of mvcc multi-version concurrency control, mvcc is the use of each piece of data behind the two hidden columns, namely the creation of version number and delete version number, each transaction at the beginning of the time there will be an incremental version number.
mysql solution cannot be repeated read:
In mysql, the default transaction isolation level is repeatable-read. To solve the problem of non-repeatable reads, innodb uses mvcc (multiversion concurrency control) to solve this problem.
mvcc uses two hidden columns (create version number and delete version number) at the end of each piece of data, so that each transaction starts with an incremental version number
Add:
insert into user (id,name,age)values(1,"ZHANG SAN",10);
Update:
update user set age = 11 where id = 1;
The update operation is implemented by delete+add. First, the current data is marked as deleted.
Then add a new piece of data:
Delete: Delete is to update the deleted version number of the data directly to the version number of the current transaction
delete from user where id = 1;
Query operation:
select * from user where id = 1;
In order to avoid querying old data or data that has been changed by other transactions, the query operation needs to meet the following conditions:
1. The version number of the current transaction during query needs to be greater than or equal to the creation version number.
2. The version number of the current transaction needs to be less than the deleted version number during query.
See also: create_version
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.