当前位置:网站首页>MySQL - transaction attributes
MySQL - transaction attributes
2022-06-10 00:57:00 【Xiao Xian.】
Recommended links :
summary ——》【Java】
summary ——》【Mysql】
summary ——》【Spring】
summary ——》【SpringBoot】
| Atomicity (Actomicity) | A transaction is an atomic unit of operation , Its modification of data , Or do it all , Or none of them . |
|---|---|
| Uniformity (Consistent) | At the beginning and end of the transaction , Data must be consistent . |
| Isolation, (Isolation) | The database provides a certain isolation mechanism , Ensure that transactions are not affected by external concurrent operations “ Independent ” Environmental execution . |
| persistence (Durable) | After the transaction completes , Its modification of data is permanent , Even if there is a system failure, it can keep . |
One 、 Atomicity (Atomicity)
A series of operations on the database , Either it's all success , Or it's all failure , There can be no partial success or partial failure .
Q: If the previous operation has been successful , Later operation failed , How to make it all fail ?
A: Roll backQ: How to implement rollback ?
A: stay InnoDB It's through undo log To achieve , It records the values before data modification ( Logic log ), Once something goes wrong , You can use it undo log To implement the rollback operation .
Two 、 Uniformity (consistent)
1、 The integrity constraints of the database itself
It means that the integrity constraints of the database are not broken , There are valid data states before and after the transaction execution .
For example, the primary key must be unique , The length of the field meets the requirements .
Example : Transfer accounts
A Decrease in account balance 1000,B The account balance only increased 500, At this time, because of the success of both operations , According to our definition of atomicity , It's atomic , But it doesn't satisfy consistency , Because it leads to the imbalance of accounting subjects .
2、 User defined integrity
User defined integrity is usually controlled in the code .
Example : Transfer accounts
A The account balance is 0, If the transfer is successful at this time ,A The balance of the account will become -1000, Although it satisfies the atomic , But we know that , The balance of debit card cannot be less than 0 Of , So it's also against consistency .
3、 ... and 、 Isolation, (isolation)
There are many transactions in the database , Operate the same table or row of data at the same time , There must be some concurrent or interfering operations , And these concurrent operations , It should be transparent , Not interfering with each other . In this way , We also guarantee the consistency of business data in the end .
Four 、 persistence (Durable)
Our arbitrary operation on the database , Additions and deletions , As long as the transaction is committed successfully , So the result is permanent , It is impossible because we have restarted the server of the database , It's back to its original state .
Q: How can persistence be achieved ? Database crash recovery (crash-safe) By what means ?
A: Persistence is through redo log To achieve .
When we operate data , Will write to memory first buffer pool Inside , Simultaneous recording redo log, If something goes wrong before you brush the disc , It can be read after restart redo log The content of , Write to disk , Ensure data persistence .
summary
Atomicity , Isolation, , persistence , It's all about consistency
边栏推荐
- BGP protocol experiment
- 重发布实验
- Cloud Mining & cloud mining chain: from order collaboration to procurement supply chain, make procurement supply chain interconnected
- 【无标题】
- Score of sub series of previous test questions and [11th] [provincial competition] [group B]
- Facial Emotion Recognition: State of the Art Performance on FER2013
- Solution to the C language problem of force deduction self divisor
- 力扣 无重复字符的最长子串 C语言 题解
- Facial Emotion Recognition: State of the Art Performance on FER2013
- Work sharing of 2018 virtual instrument competition - reconfigurable snake shaped robot based on LabVIEW, baidu map, STM32 single chip microcomputer, etc
猜你喜欢
随机推荐
RHCSA第一天
if判断是否为空时的函数选择
Score of sub series of previous test questions and [11th] [provincial competition] [group B]
第5章域内横向移动分析及防御
nn. Modulelist() and nn Sequential()
第6章域控制器安全
Wyn enterprise, an embedded business intelligence software, has officially entered the V5.0 era!
Offre de doigts II 018. Palindrome valide
剑指 Offer II 012. 左右两边子数组的和相等
Cloud Mining & cloud mining chain: from order collaboration to procurement supply chain, make procurement supply chain interconnected
Facial Emotion Recognition: State of the Art Performance on FER2013
BGP实验
Analysis on the scores of previous real questions [11th] [provincial competition] [group B]
PCI BAR寄存器详解(一)
Sword finger offer II 020 Number of palindrome substrings
重发布实验
Mysql——》事务的隔离级别
[GoogleCTF2019 Quals]Bnv -S
Apply the latest ad and Txk patches
线性规划和对偶规划学习总结

![[HFCTF2020]BabyUpload](/img/84/d3117eaffb79fac54193ac0cf7348e.png)






