Post your solutions to the Apr 4 In-Class Exercise to this thread.
Best, Chris
1. Suppose we started a non-quiescent checkpoint right after the R1(A,t1), what transactions would be listed in the start checkpoint? START CKPT(T1) 2. When would be the earliest that an end checkpoint could be written? After first COMMIT T1.
3. If an end checkpoint was written at that location, and if a crash occurred immediately after the operations above, what would be undone during recovery? all operations in T2 or T3.
4. Which of these undo operations would actually affect something on disk? O2(B)
(Edited: 2018-04-04)Transaction 1 would be the only transaction. The earliest would be right after the <COMMIT T1> <T2, B, 12> and <T3, C, 1> would be undone. Undoing <T2, B, 12> would affect something on disk because we wrote B to disk.
START T1, I1(A), R1(A,t1), t1:=t1⋅2, START T2, T1,A4 W1(A,t1), START T3, I2(B), R2(B,t2), t2:=t2⋅2, T2,B,12, W2(B,t), T3,C,1, W3(C,5), O1(A), COMMIT T1, O2(B).
Adding a checkpoint right after R1(A, t1) would only include T1, so START CKPT(T1). We can only end a checkpoint once we get a commit.
If the system crashes, then we have to undo everything not included in the checkpoint, so that would include all operations in T2 or T3.
The only operations that affect disk will be Output operations. Everything else is only changed in memory. The O1(A) is part of T1, so that has been checkpointed, but O2(B) is not checkpointed, which means the disk write will get undone.
• Since no other processes have been started, if we start a checkpoint after R1(A, t1) then only T1 will be listed in the start checkpoint
• The earliest we would see and END CHECKPOINT would be after <COMMIT T1> since there are no other transactions that were added to the start checkpoint.
• If a crash occurred after <COMMIT T1>, we need to undo T2,B,12 and T3,C,1
• The only undo operation that will affect something on disk is the Output operation O_2(B) since it was written to disk, but never committed.
(Edited: 2018-04-04)