《山东大学数据库系统英语课件16恢复系统》由会员分享,可在线阅读,更多相关《山东大学数据库系统英语课件16恢复系统(95页珍藏版)》请在金锄头文库上搜索。
1、Database System Concepts, 6th Ed.Silberschatz, Korth and SudarshanSee www.db- for conditions on re-use Chapter 16: Recovery SystemSilberschatz, Korth and Sudarshan16.2Database System Concepts - 6th EditionChapter 16: Recovery SystemnFailure ClassificationnStorage StructurenRecovery and AtomicitynLog
2、-Based RecoverynRemote Backup SystemsSilberschatz, Korth and Sudarshan16.3Database System Concepts - 6th EditionFailure ClassificationnTransaction failure :lLogical errors: transaction cannot complete due to some internal error conditionlSystem errors: the database system must terminate an active tr
3、ansaction due to an error condition (e.g., deadlock)nSystem crash: a power failure or other hardware or software failure causes the system to crash.lFail-stop assumption: non-volatile storage contents are assumed to not be corrupted by system crash4Database systems have numerous integrity checks to
4、prevent corruption of disk data nDisk failure: a head crash or similar disk failure destroys all or part of disk storagelDestruction is assumed to be detectable: disk drives use checksums to detect failuresSilberschatz, Korth and Sudarshan16.4Database System Concepts - 6th EditionRecovery Algorithms
5、nConsider transaction Ti that transfers $50 from account A to account BlTwo updates: subtract 50 from A and add 50 to B nTransaction Ti requires updates to A and B to be output to the database. lA failure may occur after one of these modifications have been made but before both of them are made. lMo
6、difying the database without ensuring that the transaction will commit may leave the database in an inconsistent statelNot modifying the database may result in lost updates if failure occurs just after transaction commitsnRecovery algorithms have two parts1.Actions taken during normal transaction pr
7、ocessing to ensure enough information exists to recover from failures2.Actions taken after a failure to recover the database contents to a state that ensures atomicity, consistency and durabilitySilberschatz, Korth and Sudarshan16.5Database System Concepts - 6th EditionStorage StructurenVolatile sto
8、rage:ldoes not survive system crasheslexamples: main memory, cache memorynNonvolatile storage:lsurvives system crasheslexamples: disk, tape, flash memory, non-volatile (battery backed up) RAM lbut may still fail, losing datanStable storage:la mythical form of storage that survives all failureslappro
9、ximated by maintaining multiple copies on distinct nonvolatile medialSee book for more details on how to implement stable storageSilberschatz, Korth and Sudarshan16.6Database System Concepts - 6th EditionStable-Storage ImplementationnMaintain multiple copies of each block on separate diskslcopies ca
10、n be at remote sites to protect against disasters such as fire or flooding.nFailure during data transfer can still result in inconsistent copies: Block transfer can result inlSuccessful completionlPartial failure: destination block has incorrect informationlTotal failure: destination block was never
11、 updatednProtecting storage media from failure during data transfer (one solution):lExecute output operation as follows (assuming two copies of each block):1.Write the information onto the first physical block.2.When the first write successfully completes, write the same information onto the second
12、physical block.3.The output is completed only after the second write successfully completes.Silberschatz, Korth and Sudarshan16.7Database System Concepts - 6th EditionStable-Storage Implementation (Cont.)nProtecting storage media from failure during data transfer (cont.):nCopies of a block may diffe
13、r due to failure during output operation. To recover from failure:1.First find inconsistent blocks:1.Expensive solution: Compare the two copies of every disk block.2.Better solution: lRecord in-progress disk writes on non-volatile storage (Non-volatile RAM or special area of disk). l Use this inform
14、ation during recovery to find blocks that may be inconsistent, and only compare copies of these. lUsed in hardware RAID systems2.If either copy of an inconsistent block is detected to have an error (bad checksum), overwrite it by the other copy. If both have no error, but are different, overwrite th
15、e second block by the first block. Silberschatz, Korth and Sudarshan16.8Database System Concepts - 6th EditionData AccessnPhysical blocks are those blocks residing on the disk. nBuffer blocks are the blocks residing temporarily in main memory.nBlock movements between disk and main memory are initiat
16、ed through the following two operations:linput(B) transfers the physical block B to main memory.loutput(B) transfers the buffer block B to the disk, and replaces the appropriate physical block there.nWe assume, for simplicity, that each data item fits in, and is stored inside, a single block.Silberschatz, Korth and Sudarshan16.9Database System Concepts - 6th EditionExample of Data AccessX Y ABx1y1 bufferBuffer Block A Buffer Block Binput(A)output(B) read(X)write(Y)diskwork areaof T1work areaof T