当前位置:网站首页>Database -- acid of transaction -- introduction / explanation
Database -- acid of transaction -- introduction / explanation
2022-07-02 10:01:00 【It blade out of sheath】
brief introduction
This article introduces the transaction of database ACID.
The transaction is ACID Four features : Atomicity (Atomic)、 Uniformity (Consistent)、 Isolation, (Isolation)、 persistence (Duration).
Atomicity (Atomic)
explain
Transaction must be atomic unit of work , Modify the data , All or nothing , All or nothing .
Uniformity (Consistent)
explain
The transaction is completed , All data must be kept consistent .
Example
user A And the user B The sum of the two is 700, No matter A and B How to transfer money between banks , The money of two users must add up to 700, This is consistency .
Isolation, (Isolation)
explain
Changes made by concurrent transactions must be isolated from changes made by any other concurrent transactions .
Detailed explanation
In a concurrent environment , When different transactions manipulate the same data at the same time , Each transaction has its own full data space . Changes made by concurrent firms must be isolated from changes made by any other concurrent firms .
When transactions view data updates , The state of the data is either the state of another transaction before it was modified , Or another transaction changes its state , Transactions do not see data in the intermediate state .
persistence (Duration)
explain
After the transaction completes , The status change of the corresponding data in the database should be Permanence Of , It will not be rolled back .
Detailed explanation
If the transaction has been committed , But data is also persistent , At this time, the system is powered off or down , You can also re operate the non persistent data according to the transaction log , Put it recovery To the state that the transaction ends successfully .
Pre written logs (Write-ahead logging, abbreviation WAL) Mechanism
Many databases use pre written logs (Write-ahead logging, abbreviation WAL) Mechanism , To ensure transaction persistence and data integrity , At the same time, the frequent data refresh based on transactions is avoided to a great extent IO Impact on performance .
In the use of WAL In the system , All changes are written to the log first , Then it is applied to the system state . Let's say a program loses power while it's doing something . On reboot , The program may need to know whether the operation performed at that time was successful or partially successful or failed . Program can check log file , Compare the planned operation content with the actual operation content in case of sudden power failure . On the basis of this comparison , The program can then decide whether to undo the action or continue to complete the action , Or keep it as it is .
边栏推荐
猜你喜欢
Image recognition - data annotation
并网逆变器PI控制(并网模式)
2837xd Code Generation - stateflow (4)
图像识别-数据标注
A model can do two things: image annotation and image reading Q & A. VQA accuracy is close to human level | demo can be played
Tinyxml2 reading and modifying files
Matlab generates DSP program -- official routine learning (6)
Inverter Simulink model -- processor in the loop test (PIL)
【虚幻】按键开门蓝图笔记
Bugkuctf-web24 (problem solving ideas and steps)
随机推荐
2837xd code generation module learning (1) -- GPIO module
Cmake command - Official Document
Introduction et prévention des essais de pénétration
Blender多镜头(多机位)切换
Attack and defense world web advanced area unserialize3
Illusion -- Animation blueprint, state machine production, character walking, running and jumping action
Int to string, int to qstring
Save video opencv:: videowriter
Read Day6 30 minutes before going to bed every day_ Day6_ Date_ Calendar_ LocalDate_ TimeStamp_ LocalTime
三相逆变器离网控制——PR控制
Eslint reports an error
The latest progress and development trend of 2022 intelligent voice technology
Introduction to go language
tinyxml2 读取和修改文件
MySQL transaction
Personal experience & blog status
Fragmenttabhost implements the interface of housing loan calculator
C language strawberry
2837xd代码生成模块学习(4)——idle_task、Simulink Coder
图像识别-数据清洗