当前位置:网站首页>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 )
边栏推荐
- Robot operation mechanism
- Efficiency difference between row first and column first traversal of mat data types in opencv
- kingbaseES V8R3数据安全案例之---审计记录清除案例
- 阿里云有奖体验:用PolarDB-X搭建一个高可用系统
- MMAP learning
- Some things make feelings nowhere to put
- Zhang Lijun: la pénétration de l’incertitude dépend de quatre « invariants»
- [Yugong series] go teaching course 003-ide installation and basic use in July 2022
- Detailed explanation of memset() function usage
- Interview questions for basic software testing
猜你喜欢

Create a virtual machine on VMware (system not installed)

Parker driver maintenance COMPAX controller maintenance cpx0200h

An exception occurred in Huawei game multimedia calling the room switching method internal system error Reason:90000017

Decorator learning 01

华为快游戏调用登录接口失败,返回错误码 -1
![[Yugong series] go teaching course 003-ide installation and basic use in July 2022](/img/9d/7d01bc1daa61f6545f619b6746f8bb.png)
[Yugong series] go teaching course 003-ide installation and basic use in July 2022

Huawei fast game failed to call the login interface, and returned error code -1

力扣------经营摩天轮的最大利润

极狐公司官方澄清声明

Kingbasees v8r3 cluster maintenance case -- online addition of standby database management node
随机推荐
SQL knowledge leak detection
装饰器学习01
A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition
华为游戏多媒体调用切换房间方法出现异常Internal system error. Reason:90000017
NET中小型企业项目开发框架系列(一个)
poj 3237 Tree(树链拆分)
KingbaseES V8R3集群维护案例之---在线添加备库管理节点
The primary key is set after the table is created, but auto increment is not set
Tips for using SecureCRT
How can Huawei online match improve the success rate of player matching
How to use tensorflow2 for cat and dog classification and recognition
阿龙的感悟
DataGrid directly edits and saves "design defects"
Getting started with microservices (resttemplate, Eureka, Nacos, feign, gateway)
Making global exception handling classes with aspect
华为联机对战如何提升玩家匹配成功几率
Matlab | app designer · I used Matlab to make a real-time editor of latex formula
Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
他们主动布局(autolayout)环境的图像编辑器
HDU 4391 paint the wall segment tree (water