70 likes | 78 Views
Learn how to identify incomplete transactions in a transaction log and determine the point at which a crash occurred. Discover the necessary steps for recovery using undo, redo, or undo/redo logging techniques.
E N D
Examples Undo, Redo, Undo/Redo
Undo Log <START S> <S,A,60> <COMMIT S> <START T> <T,A,10> <START CKPT (T)> <START U> <U,B,20> <T,C,30> <START V> <U,D,40> <V,F,70> <COMMIT U> <T,E,50> <COMMIT T> <V,B,80> <COMMIT V> • Suppose that we begin a non quiescent checkpoint immediately after <T,A,10> • Tell, • When the <END CKPT> is written? • For each possible point at which a crash could occur, how far back in the log we must look to find all the possible incomplete transactions?
Undo Log <START S> <S,A,60> <COMMIT S> <START T> <T,A,10> <START CKPT (T)> <START U> <U,B,20> <T,C,30> <START V> <U,D,40> <V,F,70> <COMMIT U> <T,E,50> <COMMIT T> <END CKPT> <V,B,80> <COMMIT V> • Suppose that we begin a non quiescent checkpoint immediately after <T,A,10> • Tell, • When the <END CKPT> is written? • For each possible point at which a crash could occur, how far back in the log we must look to find all the possible incomplete transactions? • If the crash occurs after <END CKPT>, we have to search back only to the <START CKPT(T)>. • However, for crashes prior to the <COMMIT T> record, the search must continue back as far as the <START T> record, since that is the (lone) transaction that was active at the start of the checkpoint.
Redo Log <START S> <S,A,60> <COMMIT S> <START T> <T,A,10> <START CKPT (T)> <START U> <U,B,20> <T,C,30> <START V> <U,D,40> <V,F,70> <COMMIT U> <T,E,50> <COMMIT T> <V,B,80> <COMMIT V> • Suppose that we begin a non quiescent checkpoint immediately after <T,A,10> • Tell, • When the <END CKPT> is written? • For each possible point at which a crash could occur, how far back in the log we must look to find all the possible incomplete transactions?
Redo Log <START S> <S,A,60> <COMMIT S> <START T> <T,A,10> <START CKPT (T)> <START U> <U,B,20> <T,C,30> <START V> <U,D,40> <V,F,70> <COMMIT U> <T,E,50> <COMMIT T> <V,B,80> <COMMIT V> • Suppose that we begin a non quiescent checkpoint immediately after <T,A,10> • Tell, • When the <END CKPT> could be written? • For each possible point at which a crash could occur, how far back in the log we must look to find all the possible incomplete transactions? Consider both the case that the <END CKPT> record was or was not written prior to the crash. • <END CKPT> can occur at any point after the <START CKPT(T)>. • If the crash occurs after <END CKPT>, we restrict ourselves only to committed transactions that were listed in <START CKPT(..)>, i.e. T, and those that started after this point. • If the crash occurs in between, then, for this example, we have to consider all the log.
Undo/Redo Log <START S> <S,A,60,61> <COMMIT S> <START T> <T,A,61,62> <START CKPT (T)> <START U> <U,B,20,21> <T,C,30,31> <START V> <U,D,40,41> <V,F,70,71> <COMMIT U> <T,E,50,51> <COMMIT T> <V,B,21,22> <COMMIT V> • Suppose that we begin a non quiescent checkpoint immediately after <T,A,61,62> • Tell, • When the <END CKPT> could be written? • For each possible point at which a crash could occur, how far back in the log we must look at?
Undo/Redo Log <START S> <S,A,60,61> <COMMIT S> <START T> <T,A,61,62> <START CKPT (T)> <START U> <U,B,20,21> <T,C,30,31> <START V> <U,D,40,41> <V,F,70,71> <COMMIT U> <T,E,50,51> <COMMIT T> <V,B,21,22> <COMMIT V> • Suppose that we begin a non quiescent checkpoint immediately after <T,A,61,62> • Tell, • When the <END CKPT> could be written? • For each possible point at which a crash could occur, how far back in the log we must look at? • <END CKPT> can occur at any point after the <START CKPT(T)>. • If the crash occurs after <END CKPT>, we restrict ourselves only to transactions that were listed in <START CKPT(..)>, i.e. T, and those that started after this point. • If the crash occurs in between, then, for this example, we have to consider all the log.