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

What are the different locking and unlocking methods of MySQL under RR and RC isolation levels?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you what are the different locking and unlocking methods of MySQL under the isolation level of RR and RC. I hope you will gain something after reading this article. Let's discuss it together.

| | different locking and unlocking methods for MySQL under RC and RR isolation levels |

MySQL5.7.21

Data preparation

Confirm isolation level

Open two sessions at the same time and follow the process shown below to start the operation.

3. Semi-uniform read semi-consistent read

3.1 occurrence conditions of semi-uniform reading

Innodb_locks_unsafe_for_binlog defaults to off.

If set to 1, gap locks are disabled, but gap locks are still used for foreign key conflict detection (foreign-key constraint checking) or duplicate key detection (duplicate-key checking).

Enabling innodb_locks_unsafe_for_binlog has the same impact as setting the isolation level to RC, except that:

1) innodb_locks_unsafe_for_binlog is a global parameter that affects all session;, but the isolation level can be global or session level.

2) innodb_locks_unsafe_for_binlog can only be set when the database is started, but the isolation level can be changed at any time. For the above reasons, RC is better and more flexible than innodb_locks_unsafe_for_binlog.

Enabling innodb_locks_unsafe_for_binlog also has the following functions:

Environmental preparation

Start the operation

Note: the process phenomenon meets the RR isolation level and conforms to the setting of innodb_locks_unsafe_for_binlog=ON. Because enabling innodb_locks_unsafe_for_binlog as mentioned earlier has effects 1 and 2, the whole locking and unlocking situation is similar to the RC isolation level.

After reading this article, I believe you have a certain understanding of "what are the different locking and unlocking methods of MySQL under the isolation level of RR and RC". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!

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