当前位置:网站首页>Transaction isolation level gap lock deadlock
Transaction isolation level gap lock deadlock
2022-07-01 19:36:00 【Like this, I】
1. Transaction isolation level
- serialize (SERIALIZABLE)
- Repeatable (REPEATABLE READ)
- Submit to read (READ COMMITTED)
- Uncommitted read (READ UNCOMMITTED)
The four isolation levels correspond to addition, deletion, modification and query
2.gap Lock analysis :
Uncommitted read (READ UNCOMMITTED): Add, delete, change and check without locking .
Submit to read (READ COMMITTED): Increase the time to lock the index a certain distance ( If the index is 12, Lock an index in 12 A distance up and down ), Release the lock when the transaction is committed .
Repeatable (REPEATABLE READ): Lock the index for a distance when adding, deleting or modifying data (insert Above , If the index is 12, Then lock the distance between the indexes of the previous row and the next row , If there is no previous line or next line , Then lock a distance )
serialize (SERIALIZABLE): Add, delete, change and check will be locked , Transactions can only be committed one by one , The obtained transaction locks the table directly
3.gap Deadlock
Two transaction colleagues obtained an interval lock , And simultaneously operate the interval
111 delete from ts_column_log_test wherecol_id=10;
222 delete from ts_column_log_test where col_id=11;
111 INSERT INTO ts_column_log_test (col_id,start_time, end_time, data_time, status) VALUES (10, NULL, NULL, '20111209','running');
222 INSERT INTO ts_column_log_test (col_id, start_time, end_time,data_time, status) VALUES (11, NULL, NULL, '20111209', 'running');
This is the time , You may get an error message ERROR 1213 (40001): Deadlock found when trying toget lock; try restarting transaction.
The reason is that the first two statements have been obtained [2,20) Recorded in this interval S lock , Then, the two transactions are performed on col_id=10 This location request X lock , Then a deadlock occurs , No one can ask X lock , Because they both hold S lock .
边栏推荐
- 赋能「新型中国企业」,SAP Process Automation 落地中国
- Witness the times! "The future of Renji collaboration has come" 2022 Hongji ecological partnership conference opens live broadcast reservation
- 新版国标GB28181视频平台EasyGBS如何配置WebRTC视频流格式播放?
- 任务:拒绝服务DoS
- Ffmpeg common commands (2)
- 宝,运维100+服务器很头疼怎么办?用行云管家!
- 混沌工程平台 ChaosBlade-Box 新版重磅发布
- 【sql优化】with as 和 临时表的区别
- ubuntu14安装MySQL并配置root账户本地与远程访问
- What must be done in graduation season before going to Shanhai
猜你喜欢

Interview questions for audio and video positions in Dachang -- today's headline

赋能「新型中国企业」,SAP Process Automation 落地中国

nacos启动失败问题解决与总结

论文阅读【Learning to Discretely Compose Reasoning Module Networks for Video Captioning】

ddr4测试-2

uni-app微信小程序一键登录获取权限功能

SIP protocol of gb28181

Actual combat of flutter - fast implementation of audio and video call application

Methods of finding various limits

论文阅读【Discriminative Latent Semantic Graph for Video Captioning】
随机推荐
【6.24-7.1】写作社区精彩技术博文回顾
MFC中如何重绘CListCtrl的表头
win10下使用msys+vs2019编译ffmpeg源码
Methods of finding various limits
pickle. Load error [attributeerror: can't get attribute 'volatile' on < module '\u main']
Crunch简介、安装,使用Crunch制作密码字典
Extensive reading of the paper [film: visual reasoning with a general condition layer]
Ubuntu14 install MySQL and configure root account local and remote access
What must be done in graduation season before going to Shanhai
703. 数据流中的第 K 大元素
商业智能BI开发和报表开发有什么本质区别?
OpenCV视频质量检测--清晰度检测
CMU AI PhD 第一年总结
案例分享:QinQ基本组网配置
Flutter 实战-快速实现音视频通话应用
如何正确使用Vertx操作Redis(3.9.4带源码分析)
How to redraw the header of CListCtrl in MFC
Audio and video, encoding and decoding related e-books, gadgets, packaged for free!
Collation of open source protocols of open source frameworks commonly used in Web Development
GetMessage底层机制分析