Consider the following sequence of UNDO log records: <START S> <S,A,60> <COMMIT
ID: 3810001 • Letter: C
Question
Consider the following sequence of UNDO log records:
<START S>
<S,A,60>
<COMMIT S>
<START T>
<T,A,10>
<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 nonquiscent checkpoint immediately after one of the following log records has written (in memory):
a) <S,A,60>
b) <T,A,10>
c) <U,B,20>
d) <U,D,40>
e) <T,E,50>
For each, tell:
i) When the <END CKPT> record is written, and
ii) For each possible point at which a crash could occur, how far back
Thank you!
Explanation / Answer
a) If we begin nonquiscent checkpoint immediately after <S,A,60>
i) <END CKPT> is used for undo/redo the logging. And it can be written anywhere after <START CKPT>.
ii) If the crash occurs after <END CKPT> we need to go back only to <START S>
b) If we begin nonquiscent checkpoint immediately after <T,A,10>
i) <END CKPT> is used for undo/redo the logging. And it can be written anywhere after <START CKPT>.
ii) If the crash occurs before <END CRPT> is written then we have to go back to the previous <START CKPT>.Since we dont have other checkpoints in the log file, we need to check all the records of the log file upto <START S>.
If crash occurs after <END CKPT> then no need to start from the <START S> because all transactions were committed successfully and have been written to the disk.For S the transaction is complete, so we need to check only the active transactions at the start of checkpoint. We have 2 active transactions T and U, we need to look only as far back as <START T>.
c)If we begin nonquiscent checkpoint immediately after <U,B,20>
i) <END CKPT> is used for undo/redo the logging. And it can be written anywhere after <START CKPT>.
ii) If the crash occurs before <END CRPT> is written then we have to go back to the previous <START CKPT>..Since we dont have other checkpoints in the log file, we need to check all the records of the log file upto <START S>.
If crash occurs after <END CKPT> then no need to start from the <START S> because all transactions were committed successfully and have been written to the disk.For S the transaction is complete, so we need to check only the active transactions at the start of checkpoint. We have 2 active transactions T and U, we need to look only as far back as <START T>.
d) If we begin nonquiscent checkpoint immediately after <U,D,40>
i) <END CKPT> is used for undo/redo the logging. And it can be written anywhere after <START CKPT>.
ii) If the crash occurs before <END CRPT> is written then we have to go back to the previous <START CKPT>..Since we dont have other checkpoints in the log file, we need to check all the records of the log file upto <START S>.
If crash occurs after <END CKPT> then no need to start from the <START S> because all transactions were committed successfully and have been written to the disk.For S the transaction is complete, so we need to check only the active transactions at the start of checkpoint. We have 3 active transactions T,U and V, we need to look only as far back as <START T>.
e) If we begin nonquiscent checkpoint immediately after <T,E,50>
i) <END CKPT> is used for undo/redo the logging. And it can be written anywhere after <START CKPT>.
ii) If the crash occurs before <END CRPT> is written then we have to go back to the previous <START CKPT>..Since we dont have other checkpoints in the log file, we need to check all the records of the log file upto <START S>.
If crash occurs after <END CKPT> then no need to start from the <START S> because all transactions were committed successfully and have been written to the disk.For S and U the transaction is complete, so we need to check only the active transactions at the start of checkpoint. We have 2 active transactions T and V, we need to look only as far back as <START T>.