当前位置:网站首页>Recovery technology with checkpoints
Recovery technology with checkpoints
2022-07-05 21:58:00 【Short section senior】
Problem presentation
Two questions
Searching the entire log will take a lot of time
Redo processing : Re execution , Wasted a lot of time
Solution
With checkpoints (checkpoint) Recovery technology
Add checkpoint records to the log file (checkpoint)
Add restart file
The recovery subsystem dynamically maintains the log during log file login
Checkpoint Technology
What the checkpoint records
Create a list of all transactions that are executing at checkpoint time
The last logged address of these transactions
Restart the contents of the document
Record the address of each checkpoint recorded in the log file
How to maintain log files dynamically
Periodically do the following : Set up checkpoints , Save database state .
The specific steps are :
(1) Write all the log records in the current log buffer to the log file on disk
(2) Write a checkpoint record in the log file
(3) Write all data records of the current data buffer to the database of the disk
(4) Write the address of the checkpoint recorded in the log file to a restart file
Set up checkpoints
The recovery subsystem can establish checkpoints periodically or irregularly , Save database state
regular
At a predetermined time interval , For example, set up a checkpoint every hour
Irregular
According to some rules , If the log file is half full, create a checkpoint
Recovery strategy utilizing checkpoints
Using checkpoint methods can improve recovery efficiency
When a transaction T Submit... Before a checkpoint ,T Changes made to the database have been written to the database
The write time is before or when the checkpoint is established
In recovery processing , There is no need to T Perform redo operation
When the system fails , The recovery subsystem will adopt different recovery strategies according to different transaction states
T1: Submit... Before checkpoint
T2: Start execution before checkpoint , Submit after checkpoint and before fault point
T3: Start execution before checkpoint , Not completed at the point of failure
T4: Start execution after checkpoint , Submit... Before the point of failure
T5: Start execution after checkpoint , Not completed at the point of failure
Recovery strategy
T3 and T5 Not completed at the time of failure , So it was revoked
T2 and T4 Submit after checkpoint , The changes they make to the database may still be in the buffer at the time of the failure , Not yet written to the database , So do it again
T1 Submitted before checkpoint , So you don't have to redo
Recovery steps using checkpoints
(1) Find the address of the last checkpoint recorded in the log file... From the restart file , This address finds the last checkpoint record in the log file
(2) The checkpoint records the list of all transactions being executed at the checkpoint establishment time ACTIVE-LIST
Create two transaction queues
UNDO-LIST
REDO-LIST
hold ACTIVE-LIST Put in for a while UNDO-LIST queue ,REDO The queue is temporarily empty .
(3) Scan log files forward from checkpoint , Until the end of the log file
If there is a new beginning Ti, hold Ti Put in for a while UNDO-LIST queue
If there are committed transactions Tj, hold Tj from UNDO-LIST The queue moves to REDO-LIST queue ; Until the end of the log file
(4) Yes UNDO-LIST Each transaction in performs UNDO operation
Yes REDO-LIST Each transaction in performs REDO operation
Welcome to join me for wechat exchange and discussion ( Please note csdn Add )
边栏推荐
猜你喜欢
2.2.5 basic sentences of R language drawing
matlab绘制hsv色轮图
AD637使用笔记
How to use tensorflow2 for cat and dog classification and recognition
Parker driver maintenance COMPAX controller maintenance cpx0200h
Shell script, awk condition judgment and logic comparison &||
Getting started with microservices (resttemplate, Eureka, Nacos, feign, gateway)
Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
Zhang Lijun: la pénétration de l’incertitude dépend de quatre « invariants»
1.2 download and installation of the help software rstudio
随机推荐
Countdown to 92 days, the strategy for the provincial preparation of the Blue Bridge Cup is coming~
MySQL连接断开报错MySQLdb._exceptions.OperationalError 4031, The client was disconnected by the server
HYSBZ 2243 染色 (树链拆分)
办公遇到的问题--
datagrid直接编辑保存“设计缺陷”
从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
AD637使用筆記
1.2 download and installation of the help software rstudio
854. 相似度为 K 的字符串 BFS
MMAP learning
Alibaba cloud award winning experience: build a highly available system with polardb-x
递归查询多级菜单数据
[Yugong series] go teaching course 003-ide installation and basic use in July 2022
阿龙的感悟
让开发效率提升的跨端方案
Incentive mechanism of Ethereum eth
MATLAB | App Designer·我用MATLAB制作了一款LATEX公式实时编辑器
Cold violence -- another perspective of objective function setting
QML reported an error expected token ";", expected a qualified name ID
How can Huawei online match improve the success rate of player matching