资源预览内容
第1页 / 共95页
第2页 / 共95页
第3页 / 共95页
第4页 / 共95页
第5页 / 共95页
第6页 / 共95页
第7页 / 共95页
第8页 / 共95页
第9页 / 共95页
第10页 / 共95页
亲,该文档总共95页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
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-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 transaction 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 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 AlgorithmsnConsider 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. lModifying 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 processing 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 storage: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 failureslapproximated 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 can 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 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 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 differ 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 information 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 the 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 initiated 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
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号