Examples Undo Redo UndoRedo START S S A

  • Slides: 7
Download presentation
Examples Undo, Redo, Undo/Redo

Examples Undo, Redo, Undo/Redo

<START S> <S, A, 60> <COMMIT S> <START T> <T, A, 10> <START CKPT

<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> Undo Log • • Suppose that we begin a non quiescent checkpoint immediately after <T, A, 10> Tell, 1. When the <END CKPT> is written? 2. 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?

<START S> <S, A, 60> <COMMIT S> <START T> <T, A, 10> <START CKPT

<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> Undo Log • • 1. 2. Suppose that we begin a non quiescent checkpoint immediately after <T, A, 10> Tell, 1. When the <END CKPT> is written? 2. 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.

<START S> <S, A, 60> <COMMIT S> <START T> <T, A, 10> <START CKPT

<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> Redo Log • • Suppose that we begin a non quiescent checkpoint immediately after <T, A, 10> Tell, 1. When the <END CKPT> is written? 2. 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?

<START S> <S, A, 60> <COMMIT S> <START T> <T, A, 10> <START CKPT

<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> Redo Log • • 1. 2. 3. Suppose that we begin a non quiescent checkpoint immediately after <T, A, 10> Tell, 1. When the <END CKPT> could be written? 2. 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,

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, 1. When the <END CKPT> could be written? 2. 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,

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> • • 1. 2. 3. Suppose that we begin a non quiescent checkpoint immediately after <T, A, 61, 62> Tell, 1. When the <END CKPT> could be written? 2. 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.