Professional Documents
Culture Documents
CS554 - Advanced Database Systems Homework 8: Undo-Log Records
CS554 - Advanced Database Systems Homework 8: Undo-Log Records
html
<START T>
<T, A, 10>
<START U>
<U, B, 20>
<T, C, 30>
<U, D, 40>
<C0MMIT U>
<T, E, 50>
<C0MMIT T>
Describe the action of the recovery manager by stating which database elments will be updated with which
value if there is a crash and the last log record to appear on disk is:
<START U>
<START T>
<T, A, 10>
<START U>
Uncommitted transactions: T
Undo T:
Update A with 10
<C0MMIT U>
<START T>
<T, A, 10>
<START U>
<U, B, 20>
<T, C, 30>
<U, D, 40>
<C0MMIT U>
Uncommitted transactions: T
Undo T:
Update A with 10
Update C with 30
<T, E, 50>
<START T>
<T, A, 10>
<START U>
<U, B, 20>
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 1/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
<T, C, 30>
<U, D, 40>
<C0MMIT U>
<T, E, 50>
Uncommitted transactions: T
Undo T:
Update A with 10
Update C with 30
Update E with 50
<C0MMIT T>
Do nothing
1. Suppose that we begin a nonquiescent checkpoint at the position given in the following undo log:
Questions:
Indicate in the above figure the location where the <END CKPT> record will be written
If the <END CKPT> record cannot have been written, state this as your answer
Suppose we found the log in the above state; i.e.: the <END CKPT> was not written
Indicate in the above figure the further location back in the log that we must look to find all
log records used to recover from the crash
2. Suppose that we begin a nonquiescent checkpoint at the position given in the following undo log:
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 2/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
<START S>
<S, A ,60>
<C0MMIT S>
<START T> <-------- Go back till here
<T, A , 10>
<START CHKT(T)>
<START U>
<U, B, 20>
<T, C, 30>
<START V>
<U, D, 40>
<V, F, 70>
<C0MMIT U>
<T ,E , 50>
<C0MMIT T>
<END CHKT>
<V ,B , 80>
Questions:
Indicate in the above figure the location where the <END CKPT> record will be written
If the <END CKPT> record cannot have been written, state this as your answer
Suppose we found the log in the above state; i.e.: the <END CKPT> was not written
Indicate in the above figure the further location back in the log that we must look to find all
incomplete transactions when a crash occurs.
3. Suppose that we begin a nonquiescent checkpoint at the position given in the following undo log:
<START S>
<S, A ,60>
<C0MMIT S>
<START T> <-------- Go back till here
<T, A , 10>
<START U>
<U, B, 20>
<START CHKT(T,U)>
<T, C, 30>
<START V>
<U, D, 40>
<V, F, 70>
<C0MMIT U>
<T ,E , 50>
<C0MMIT T>
<END CHKT>
<V ,B , 80>
Questions:
Indicate in the above figure the location where the <END CKPT> record will be written
If the <END CKPT> record cannot have been written, state this as your answer
Suppose we found the log in the above state; i.e.: the <END CKPT> was not written
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 3/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
Indicate in the above figure the further location back in the log that we must look to find all
incomplete transactions when a crash occurs.
4. Suppose that we begin a nonquiescent checkpoint at the position given in the following undo log:
<START S>
<S, A ,60>
<C0MMIT S>
<START T> <-------- Go back till here
<T, A , 10>
<START U>
<U, B, 20>
<T, C, 30>
<START V>
<U, D, 40>
<V, F, 70>
<C0MMIT U>
<START CHKT(T,V)>
<T ,E , 50>
<C0MMIT T>
<V ,B , 80> ---- Check point did not finish !!!
Questions:
Indicate in the above figure the location where the <END CKPT> record will be written
If the <END CKPT> record cannot have been written, state this as your answer
**** Checkpoint did not complete because transaction V has not committed.
Suppose we found the log in the above state; i.e.: the <END CKPT> was not written
Indicate in the above figure the further location back in the log that we must look to find all
incomplete transactions when a crash occurs.
<START T>
<T, A, 10>
<START U>
<U, B, 20>
<T, C, 30>
<U, D, 40>
<C0MMIT U>
<T, E, 50>
<C0MMIT T>
Describe the action of the recovery manager by stating which database elments will be updated with which
value if there is a crash and the last log record to appear on disk is:
<START U>
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 4/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
Redo log is:
<START T>
<T, A, 10>
<START U>
Do nothing
<C0MMIT U>
<START T>
<T, A, 10>
<START U>
<U, B, 20>
<T, C, 30>
<U, D, 40>
<C0MMIT U>
Committed transactions: U
Redo U:
Update B with 20
Update D with 40
<T, E, 50>
<START T>
<T, A, 10>
<START U>
<U, B, 20>
<T, C, 30>
<U, D, 40>
<C0MMIT U>
<T, E, 50>
Uncommitted transactions: U
Redo U:
Update B with 20
Update D with 40
<C0MMIT T>
Committed transactions: T, U
Redo T:
Update A with 10
Update C with 30
Update E with 50
Redo U:
Update B with 20
Update D with 40
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 5/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
1. Suppose there was a system crash and the content of the redo log is:
Questions:
Indicate in the above figure the furthest log record in the log that we must check to find (=
identify) all committed transactions when the crash occured.
Label this location with an arrow and label the arrow with the letter A
Which database element(s) is/are updated to what value (on disk) during the checkpointing
operation
The committed transaction between location A and end of log are: S and U
A = 60
B = 20
D = 40
Abort T
Abort V
2. Suppose there was a system crash and the content of the redo log is:
<START S>
<S, A ,60>
<C0MMIT S>
<START T> <---------- A
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 6/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
<T, A , 10>
<START CHKT(T)>
<START U>
<U, B, 20>
<T, C, 30>
<START V>
<U, D, 40>
<V, F, 70>
<C0MMIT U>
<T ,E , 50>
<END CHKT>
<C0MMIT T>
<V ,B , 80>
Questions:
Indicate in the above figure the furthest log record in the log that we must check to find (=
identify) all committed transactions when the crash occured.
Label this location with an arrow and label the arrow with the letter A
Which database element(s) is/are updated to what value (on disk) during the checkpointing
operation
The committed transaction between location A and end of log are: U and T
B = 20
D = 40
A = 10
C = 30
E = 50
Abort V
3. Suppose there was a system crash and the content of the redo log is:
<START S>
<S, A ,60>
<C0MMIT S>
<START T> <------- A
<T, A , 10>
<START U>
<U, B, 20>
<START CHKT(T,U)>
<T, C, 30>
<START V>
<U, D, 40>
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 7/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
<V, F, 70>
<C0MMIT U>
<T ,E , 50>
<C0MMIT T>
<END CHKT>
<V ,B , 80>
Questions:
Indicate in the above figure the furthest log record in the log that we must check to find (=
identify) all committed transactions when the crash occured.
Label this location with an arrow and label the arrow with the letter A
Which database element(s) is/are updated to what value (on disk) during the checkpointing
operation
The committed transaction between location A and end of log are: U and T
B = 20
D = 40
A = 10
C = 30
E = 50
Abort V
4. Suppose there was a system crash and the content of the redo log is:
<START S>
<S, A ,60>
<C0MMIT S>
<START T> <------- A
<T, A , 10>
<START U>
<U, B, 20>
<T, C, 30>
<START V>
<U, D, 40>
<V, F, 70>
<C0MMIT U>
<START CHKT(T,V)>
<T ,E , 50>
<C0MMIT T>
<V ,B , 80>
<END CHKT>
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 8/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
Questions:
Indicate in the above figure the furthest log record in the log that we must check to find (=
identify) all committed transactions when the crash occured.
Label this location with an arrow and label the arrow with the letter A
Which database element(s) is/are updated to what value (on disk) during the checkpointing
operation
A = 10
C = 30
E = 50
Abort V
<START T>
<T, A, 10, 11>
<START U>
<U, B, 20, 21>
<T, C, 30, 31>
<U, D, 40, 41>
<C0MMIT U>
<T, E, 50, 51>
<C0MMIT T>
Describe the action of the recovery manager by stating which database elments will be updated with which
value if there is a crash and the last log record to appear on disk is:
<START U>
<START T>
<T, A, 10, 11>
<START U>
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 9/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
Uncommitted transactions: T
Committed transactions: none
Answer: (undo T)
Update A to 10
<C0MMIT U>
<START T>
<T, A, 10, 11>
<START U>
<U, B, 20, 21>
<T, C, 30, 31>
<U, D, 40, 41>
<C0MMIT U>
Uncommitted transactions: T
Committed transactions: U
Update C with 30
Update A with 10
Update B with 21
Update D with 41
<T, E, 50>
<START T>
<T, A, 10, 11>
<START U>
<U, B, 20, 21>
<T, C, 30, 31>
<U, D, 40, 41>
<C0MMIT U>
<T, E, 50, 51>
Uncommitted transactions: T
Committed transactions: U
Update E with 50
Update C with 30
Update A with 10
Update B with 21
Update D with 41
<C0MMIT T>
Committed transactions: U, T
Redo U:
Update B with 21
Update D with 41
Redo T:
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 10/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
Update A with 11
Update C with 31
Update E with 51
1. Suppose there was a system crash and the content of the undo/redo log is:
<START S>
<S, X ,60, 61>
<START CHKT(S)> <---- A
<C0MMIT S>
<START T>
<T, A, 10, 11>
<START U>
<U, B, 20, 21>
<END CHKT>
<T, C, 30, 31>
<START V>
<U, D, 40, 41>
<V, F, 70>
<C0MMIT U>
<T ,E, 50, 51>
Questions:
Indicate in the above figure the furthest log record in the log that we must check to find (=
identify) all committed and uncommitted transactions when the crash occured.
Label this location with an arrow and label the arrow with the letter A
Which database element(s) is/are updated to what value (on disk) during the checkpointing
operation
The uncommitted transaction between location A and end of log are: T and V
The committed transaction between location A and end of log are: S and U
A = 10
C = 30
E = 50
F = 70
X = 61
B = 21
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 11/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
D = 41
Abort T
Abort V
2. Suppose there was a system crash and the content of the undo/redo log is:
<START S>
<S, X, 60, 61>
<C0MMIT S>
<START T>
<T, A ,10, 11>
<START CHKT(T)> <------ A
<START U>
<U, B, 20, 21>
<T, C, 30, 31>
<START V>
<U, D, 40, 41>
<V, F, 70, 71>
<C0MMIT U>
<T, E, 50, 51>
<END CHKT>
<C0MMIT T>
<V ,Y, 80, 81>
Questions:
Indicate in the above figure the furthest log record in the log that we must check to find (=
identify) all committed and uncommitted transactions when the crash occured.
Label this location with an arrow and label the arrow with the letter A
Which database element(s) is/are updated to what value (on disk) during the checkpointing
operation
F = 70
Y = 80
B = 21
D = 51
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 12/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
A = 11
C = 31
E = 51
3. Write to log:
Abort V
3. Suppose there was a system crash and the content of the undo/redo log is:
<START S>
<S, X, 60, 61>
<C0MMIT S>
<START T>
<T, A, 10, 11>
<START U>
<U, B, 20, 21>
<START CHKT(T,U)> <------ A
<T, C, 30, 31>
<START V>
<U, D, 40, 41>
<V, F, 70, 71>
<C0MMIT U>
<T, E, 50, 51>
<C0MMIT T>
<END CHKT>
<V, Y, 80, 81>
Questions:
Indicate in the above figure the furthest log record in the log that we must check to find (=
identify) all committed and uncommitted transactions when the crash occured.
Label this location with an arrow and label the arrow with the letter A
Which database element(s) is/are updated to what value (on disk) during the checkpointing
operation
F = 70
Y = 80
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 13/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
B = 21
D = 51
A = 11
C = 31
E = 51
3. Write to log:
Abort V
4. Suppose there was a system crash and the content of the undo/redo log is:
<START S>
<S, X, 60, 61>
<C0MMIT S>
<START T>
<T, A, 10, 11>
<START U>
<U, B, 20, 21>
<T, C, 30, 31>
<START V>
<U, D, 40, 41>
<V, F, 70, 71>
<C0MMIT U>
<START CHKT(T,V)> <------ A
<T, E, 50, 51>
<C0MMIT T>
<V, Y, 80, 81>
<END CHKT>
Questions:
Indicate in the above figure the furthest log record in the log that we must check to find (=
identify) all committed and uncommitted transactions when the crash occured.
Label this location with an arrow and label the arrow with the letter A
Which database element(s) is/are updated to what value (on disk) during the checkpointing
operation
(S and U's updates are writted to disk and don't need to be recovered !)
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 14/15
4/27/2021 www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html
F = 70
Y = 80
A = 11
C = 31
E = 51
3. Write to log:
Abort V
www.mathcs.emory.edu/~cheung/Courses/554/public/hw9/hw9-ans.html 15/15