当前位置:网站首页>Yyds dry inventory MySQL RC transaction isolation level implementation
Yyds dry inventory MySQL RC transaction isolation level implementation
2022-07-01 16:58:00 【Official account javaedge】
Read Committed, During the transaction , As long as other transactions modify the data and submit , You can read the data modified by others , So there will be non repeatable 、 The problem of unreal reading .
ReadView The mechanism is based on undo log A set of view reading mechanism implemented by version chain , The transaction generates a ReadView:
- If the data is updated for the transaction itself , I can read
- Or when you generate ReadView The value modified by the previously submitted transaction , Also readable
- But if you generate ReadView when , It's already active , But if it's in your generation ReadView Then modified the data and submitted , You can't read
- Or you generate ReadView The transaction started later modifies the data , Also submitted , I can't read
So the above mechanism is ReadView How a principle of is based on ReadView Realization RC? Core design : When a transaction is set RC, Every time he makes a query , Regenerate a ReadView!
There is a row of data in the database , It's a business id=50 A business of , Inserted a long time ago , Currently active transactions :
- Business A(id=60)
- Business B(id=70)
Now business B launch update, Update this data to b, So at this time, the data trx_id Will become a business B Of id=70, At the same time, a undo log:

At this time , Business A To initiate a query operation , It will generate a ReadView

When the transaction A Initiate a query , Find the current data trx_id=70. Belong to ReadView The business of id Between ranges , It means that he generated ReadView There was this active business before , It is this transaction that modifies the value of this data , But at this point the business B It hasn't been submitted yet , therefore ReadView Of m_ids In the active transaction list , Yes [60, 70] Two id, At this point, according to ReadView Mechanism , Business A Cannot find transaction B Modified value b.
Then follow it undo log Look down the version chain , You'll find an original value , Found that the trx_id yes 50, Less than the present ReadView Inside min_trx_id, It means that he generated ReadView Before , There is a transaction that inserts this value and has already committed , So you can find the original value .
next , What if B Submit , When submitted, the transaction will be explained B Will not be active in the database . Business A Check again next time , You can read the transaction B The modified value . How on earth does that make things A Be able to read the submitted transaction B The modified value ?
Make the transaction A Next time you initiate a query , Regenerate into one ReadView, The only active transactions in the database are transactions A, therefore :
- min_trx_id yes 60
- mac_trx_id yes 71
- m_ids=60, Business B Of id=70 Will not appear in m_ids Active transaction list
At this point, the transaction A Again, based on this ReadView Go to query , You'll find this data trx_id=70, Although in ReadView Of min_trx_id and max_trx_id Between ranges , But not at this time m_ids In the list , Explain the business B When generating this ReadView Submitted before . Explain that you can find the transaction this time B The modified value , At this point, the transaction A You'll find the value B.
边栏推荐
- AI college entrance examination volunteer filling: the gods of Dachang fight, and candidates pay to watch
- SQL注入漏洞(Mysql与MSSQL特性)
- Leetcode records - sort -215, 347, 451, 75
- P2592 [zjoi2008] birthday party (DP)
- 判断一棵二叉树是否为平衡二叉树
- Alibaba cloud, Zhuoyi technology beach grabbing dialogue AI
- Rhcsa Road
- Transition technology from IPv4 to IPv6
- SQL question brushing 1050 Actors and directors who have worked together at least three times
- 【Kotlin】高阶函数介绍
猜你喜欢

SQL question brushing 1050 Actors and directors who have worked together at least three times

Today, at 14:00, 15 ICLR speakers from Hong Kong University, Beihang, Yale, Tsinghua University, Canada, etc. continue!

National Security Agency (NSA) "sour Fox" vulnerability attack weapon platform technical analysis report

6月刊 | AntDB数据库参与编写《数据库发展研究报告》 亮相信创产业榜单

sql刷题586. 订单最多的客户

SQL注入漏洞(Mysql与MSSQL特性)

Alibaba cloud, Zhuoyi technology beach grabbing dialogue AI

Iommu/smmuv3 code analysis (10) page table operation

How to repair the laptop that cannot connect to the wireless network

今天14:00 | 港大、北航、耶鲁、清华、加大等15位ICLR一作讲者精彩继续!
随机推荐
6月刊 | AntDB数据库参与编写《数据库发展研究报告》 亮相信创产业榜单
Are you still using charged document management tools? I have a better choice! Completely free
Germany if was crowned with many awards. How strong is this pair of headphones? In depth evaluation of yinpo GTW 270 hybrid
Judge whether the binary tree is a binary search tree
unity3d扩展工具栏
Please, stop painting star! This has nothing to do with patriotism!
String类
【直播预约】数据库OBCP认证全面升级公开课
剑指 Offer II 015. 字符串中的所有变位词
AI college entrance examination volunteer filling: the gods of Dachang fight, and candidates pay to watch
Rhcsa Road
What is the effect of choosing game shield safely in the game industry?
游戏行业安全选择游戏盾,效果怎么样?
【flask入门系列】Cookie与Session
libcurl下载文件的代码示例
Buuctf gold III
Research and investment strategy report of neutral protease industry in China (2022 Edition)
Redis Distributed Lock
ACM MM 2022视频理解挑战赛视频分类赛道冠军AutoX团队技术分享
ACL 2022 | 分解的元学习小样本命名实体识别