当前位置:网站首页>Type of fault
Type of fault
2022-07-05 21:58:00 【Short section senior】
Failure within a transaction
Failure within a transaction
Some can be found through the transaction program itself ( See the example of transfer transaction below )
Some are unexpected , That cannot be handled by a transactional program .
for example , Bank transfer transactions , This transaction transfers an amount from one account a to another account b .
BEGIN TRANSACTION
Read the balance of account a BALANCE;
BALANCE=BALANCE-AMOUNT; /*AMOUNT Is the transfer amount */
IF(BALANCE < 0 ) THEN
{
Print ‘ Insufficient amount , Can't transfer ’;
/* Internal transactions may cause transactions to be rolled back */
ROLLBACK; /* Undo the changes just made , Resume business */
}
ELSE
{
Read the balance of account b BALANCE1;
BALANCE1=BALANCE1+AMOUNT;
Write back to BALANCE1;
COMMIT;}
The two update operations included in this example are either completed or not done at all . Otherwise, the database will be in an inconsistent state , For example, only the balance of account a is reduced, but the balance of account B is not increased .
In this procedure, if the balance of account a is insufficient , The application can discover and roll transactions back , Undo the changes made , Restore the database to the correct state .
More failures within the transaction are unexpected , It can't be handled by an application .
Operation overflow
A concurrent transaction has a deadlock and is selected to undo the transaction
Termination for violation of certain integrity restrictions, etc
in the future , Transaction failure only refers to this kind of unexpected failure
Transaction failure means
The transaction did not reach the expected end point (COMMIT Or explicitly ROLLBACK)
The database may be in an incorrect state .
Recovery of transaction failure : Transaction undo (UNDO)
Force rollback (ROLLBACK) This transaction
Undo any changes made to the database by the transaction , Make the transaction seem to have not started at all
System failure
System failure
It's called soft fault , It refers to any event that causes the system to stop working , bring
The system needs to restart .
The normal operation of the whole system was suddenly destroyed
All running transactions terminate abnormally
Do not destroy the database
All information in the database buffer in memory is lost
Common causes of system failures
Specific types of hardware errors ( Such as CPU fault )
Operating system failure
Database management system code error
System power failure
Recovery of system failure
In the event of a system failure , The results of some unfinished transactions may have been sent to the physical database , This may cause the database to be in an incorrect state .
Recovery strategy : When the system restarts , The recovery program rolls back all abnormally terminated transactions , Forcibly withdraw (UNDO) All outstanding transactions
In the event of a system failure , Some completed transactions may be partially or even completely left in the buffer , Not yet written back to the physical database on disk , The system failure makes some or all of the modifications of these transactions to the database lost
Recovery strategy : When the system restarts , The recovery program needs to be redone (REDO) All committed transactions
Media failure
Media failure
It's called hard fault , Refers to external memory failure
Disk damage
Head collision
Instantaneous strong magnetic field interference
Media failure destroys the database or part of the database , And affect all transactions that are accessing this data
Medium failure is much less likely than the first two types of failure , But it's much more destructive
Computer virus
Computer virus
An artificial failure or destruction , It's a computer program developed by some pranksters
It can reproduce and spread , Cause harm to computer system, including database
Types of computer viruses
The only small viruses are 20 Orders , Less than 50B
A large virus is like an operating system , It consists of tens of thousands of instructions
The harm of computer virus
Some viruses spread quickly , Once you invade the system, destroy the system immediately
Some viruses have a long incubation period , Computers don't start to get sick until a few days or months after infection
Some viruses infect all the programs and data of the system
Some are only interested in certain specific programs and data
Computer viruses have become a major threat to computer systems , Naturally, it is also the main threat to the database system
Once the database is damaged, we still need to use recovery technology to recover the database
Breakdown summary
Various faults , There are two possibilities for the impact on the database
One is that the database itself is destroyed
Second, the database has not been damaged , But the data may not be correct , This is caused by the abnormal termination of the transaction .
recovery
Basic principles of recovery operation : redundancy
Use the redundant data stored elsewhere in the system to reconstruct the damaged or incorrect part of the data in the database
Recovery implementation technology : complex
A large database product , The code of the recovery subsystem accounts for 10% above
Welcome to join me for wechat exchange and discussion ( Please note csdn Add )
边栏推荐
- Daily question brushing record (XIV)
- 微服務鏈路風險分析
- sql常用语法记录
- Zhang Lijun: penetrating uncertainty depends on four "invariants"
- EL与JSTL注意事项汇总
- The solution to the problem that Oracle hugepages are not used, causing the server to be too laggy
- Experienced inductance manufacturers tell you what makes the inductance noisy. Inductance noise is a common inductance fault. If the used inductance makes noise, you don't have to worry. You just need
- Huawei cloud modelarts text classification - takeout comments
- 每日刷题记录 (十四)
- Scenario interview: ten questions and ten answers about distributed locks
猜你喜欢
Huawei game multimedia service calls the method of shielding the voice of the specified player, and the error code 3010 is returned
How can Huawei online match improve the success rate of player matching
Uni app Bluetooth communication
Shell script, awk condition judgment and logic comparison &||
Recursive query of multi-level menu data
阿里云有奖体验:用PolarDB-X搭建一个高可用系统
Installation of VMware Workstation
Incentive mechanism of Ethereum eth
华为游戏多媒体调用切换房间方法出现异常Internal system error. Reason:90000017
AD637使用笔记
随机推荐
Shell script, awk condition judgment and logic comparison &||
Advantages of robot framework
Cross end solutions to improve development efficiency
Bitbucket installation configuration
DataGrid directly edits and saves "design defects"
How to view Apache log4j 2 remote code execution vulnerability?
[Yugong series] go teaching course in July 2022 004 go code Notes
How to use tensorflow2 for cat and dog classification and recognition
poj 3237 Tree(树链拆分)
Summarize the reasons for 2XX, 3xx, 4xx, 5xx status codes
poj 3237 Tree(樹鏈拆分)
ESP32
AD637使用笔记
854. String BFS with similarity K
资深电感厂家告诉你电感什么情况会有噪音电感噪音是比较常见的一种电感故障情况,如果使用的电感出现了噪音大家也不用着急,只需要准确查找分析出什么何原因,其实还是有具体的方法来解决的。作为一家拥有18年品牌
Experienced inductance manufacturers tell you what makes the inductance noisy. Inductance noise is a common inductance fault. If the used inductance makes noise, you don't have to worry. You just need
Net small and medium-sized enterprise project development framework series (one)
GCC9.5离线安装
Basic grammar of interview (Part 1)
Recursive query of multi-level menu data