Databases System. The complete book. Exercise 17.2.7 . Consider the following se
ID: 3824270 • Letter: D
Question
Databases System. The complete book. Exercise 17.2.7. Consider the following sequence of log records:
<START S>;
< S,A ,60>;
<C0MMIT S>;
<START T>;
< T ,A , 10>;
< START U>;
<U ,B, 20>;
< T,C , 30>;
<START V >;
<U,D, 40>;
<V,F,70>;
<C0MMIT U>;
< T ,E , 50>;
<C0MMIT T >;
< V ,B , 80>;
<C0MMIT V>.
Suppose that we begin a nonquiescent checkpoint immediately after one of the following log records has been written (in memory):
(a) <S, j4, 60> (b) <T, A, 10> (c) <U,B,20> (d) <U,D, 40> (e) < T ,E , 50>
The Question: 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 in the log we must look to find all possible incomplete transactions.
Explanation / Answer
<S, j4, 60>.
=> for undo/redo logging, the <END CKPT> can be written anywhere after the <START CKPT>.
=> The <END CKPT> record indicates that all the “dirty”, meaning changed in the buffer but not written to the disk, transactions that have
been committed before the start of the checkpoint are written to the disk.
=> This action is independent of how the database elements are saved to the disk.
=> Therefore, it can appear anywhere after <START CKPT>
<U, B, 20>.
i) For undo/redo logging, the <END CKPT> can be written anywhere after the <START CKPT>.
=> The <END CKPT> record indicates that all the “dirty”, meaning changed in the buffer but not written to the disk, transactions that have
been committed before the start of the checkpoint are written to the disk.
=> This action is independent of how the database elements are saved to the disk.
=> Therefore, it can appear anywhere after <START CKPT>.
ii) If the crash occurs before the record <END CKPT> is written, we have to go back as far as the start of the previous <START CKPT>.
=> Since there are no other checkpoints in the log file, we have to examine all the records of the log file up to <START S>.
=> If the crash occurs after <END CKPT>, we know that all the transactions that have been committed prior to the start of the checkpoint
have been written to the disk.
=> So the transaction for S is complete and written to the disk.
=> Therefore, we need only to examine the active transactions at the start of the checkpoint.
=> Since there are two active transactions T and U, we need to look only as far back as <START T> because T has the earliest start point of the two
<U, D, 40>.
i) For undo/redo logging, the <END CKPT> can be written anywhere after the <START CKPT>.
=> The <END CKPT> record indicates that all the “dirty”, meaning changed in the buffer but not written to the disk, transactions that have
been committed before the start of the checkpoint are written to the disk.
=> This action is independent of how the database elements are saved to the disk.
=> Therefore, it can appear anywhere after <START CKPT>.
ii) If the crash occurs before the record <END CKPT> is written, we have to go back as far as the start of the previous <START CKPT>.
=> Since there are no other checkpoints in the log file, we have to examine all the records of the log file up to <START S>.
=> If the crash occurs after <END CKPT>, we know that all the transactions that have been committed prior to the start of the checkpoint have been written to the disk.
=> So the transaction for S is complete and written to the disk.
=> Therefore, we need only to examine the active transactions at the start of the checkpoint.
=> Since there are now three active transactions T, U, and V, we need to look only as far back as <START T> because T has the earliest start point of the three
<T, E, 50>.
i) For undo/redo logging, the <END CKPT> can be written anywhere after the <START CKPT>.
=> The <END CKPT> record indicates that all the “dirty”, meaning changed in the buffer but not written to the disk, transactions that have
been committed before the start of the checkpoint are written to the disk.
=> This action is independent of how the database elements are saved to the disk.
=> Therefore, it can appear anywhere after <START CKPT>.
ii) If the crash occurs before the record <END CKPT> is written, we have to go back as far as the start of the previous <START CKPT>.
=> Since there are no other checkpoints in the log file, we have to examine all the records of the log file up to <START S>.
=> If the crash occurs after <END CKPT>, we know that all the transactions that have been committed prior to the start of the checkpoint have been written to the disk.
=> So the transaction for S and U are complete and written to the disk.
=> Therefore, we need only to examine the active transactions at the start of the checkpoint.
=> Since there are two active transactions T and V, we need to look only as far back as <START T> because T has the earliest start point of the three.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.