Logging + Recovery View as a PDF
Short Answer
- What does a commit record guarantee for that transaction?
- If a system can never crash, is recovery system necessary?
- Explain what each of the four log entries does: start, update, commit, and checkpoint.
- In immediate database modification, what happens when a write command is issued? How does this explain why it is necessary to undo or redo writes when there is a system failure?
Question 1
Consider a database with the following initial values, and the attached command log:
A = 41, B = 66, C = -2, D = 104, E = 23
LOG:
< T0, start >
< T1, start >
< T1, B, 66, 102 >
< T2, start >
< T2, C, -2, 99 >
< T1, B, 102, 142 >
< checkpoint : T0, T1, T2 >
< T0, A, 41, 100 >
< T3, start >
< T2, commit >
< T3, D, 104, -40 >
< T3, commit >
< T4, start >
< T4, E, 23, 24 >
Consider the situation where the system crashes before the remaining transactions can commit. Use the recovery protocol for concurrent transactions (which persists all in-memory dirty pages and transaction log entries at each checkpoint) to answer the following questions. Assume immediate database modification.
- List any transactions that will need to be undone or redone in the recovery process.
- List, in order, the set of logged operations to be performed to undo or redo the transactions, using the recovery protocol for concurrent transactions. (i.e. "Set A to 7", "Set B to 39", etc.)
- Give the final values for A, B, C, D, and E after the recovery.
Question 2
Assume the following transactions: T1, T2 and T3:
time | T1 | T2 | T3 |
---|---|---|---|
1 | R(A) | ||
2 | R(A) | ||
3 | W(C) | ||
4 | R(B) | ||
5 | R(C) | ||
6 | W(B) |
Assume that the transactions begin at the following timestamps, T1: 2, T2: 4, T3: 1. All transactions will commit at the same time. Will any transactions in this schedule abort if we are using the time-stamp protocol? Which one(s)?
Feedback
As this is a new course, we appreciate any feedback you have for us! If you enjoyed this assignment, hated this assignment, or have other thoughts to share, please do so here!