Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis of InnoDB transaction locking

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article was first posted on the official account of Wechat, vivo Internet technology.

Link: https://mp.weixin.qq.com/s/S7MhlsZveBHRSQhq5aTIJA

Author: he Zhichuang

In general, people's understanding of database transactions may stay at the ACID characteristics of transactions and the four different isolation levels of transactions, but relatively little is known about how to implement the four different isolation levels of transactions.

This paper takes the MySQL database InnoDB engine as an example to analyze the specific implementation of the default isolation level repeatable readability (RR) by the InnoDB database engine.

Introduction to the whole article: transaction four isolation levels, problems solved by different isolation levels, MVCC, lock types, lock case analysis; read the complete article, I believe you have a certain understanding of the specific implementation of transaction isolation level.

I. isolation levels of transactions 1 and 4 isolation levels

(1) uncommitted read (Read uncommitted): one transaction reads uncommitted data from other transactions, which is the lowest isolation mechanism.

(2) commit Read committed: one transaction reads the data committed by another transaction.

(3) Repeatable read: a transaction reads the same data in the same way, regardless of other transactions' modifications to the data.

(4) Serializable: transaction serialization is executed with the highest isolation level at the expense of system concurrency.

2. Problems solved by different isolation levels

If the isolation level of the transaction is not considered, the concurrency of the transaction can cause the following problems:

(1) dirty reading: transaction A reads the data updated by transaction B, and then B rolls back the operation, then the data read by An is dirty data.

(2) non-repeatable reading: transaction A reads the same data many times, and transaction B updates and commits the data in the process of reading the same data many times, resulting in inconsistent results when transaction A reads the same data many times.

(3) Phantom reading: reading the same range of data in the same transaction, but resulting in more data or less data, this is called phantom reading. (just like a transaction to id

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report