2018-04-04

Apr 4 In-Class Exercise Thread.

Post your solutions to the Apr 4 In-Class Exercise to this thread.
Best, Chris
Post your solutions to the Apr 4 In-Class Exercise to this thread. Best, Chris

-- Apr 4 In-Class Exercise Thread
  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)
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)

-- Apr 4 In-Class Exercise Thread
 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.
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.

-- Apr 4 In-Class Exercise Thread
1. <START CKPT(T1)>
2. <COMMIT T1>, <END CKPT> , O2<B>
3. <T2, B, 12> and <T3, C, 1>
4. B
(Edited: 2018-04-04)
1. <START CKPT(T1)> 2. <COMMIT T1>, '''<END CKPT>''', O2<B> 3. <T2, B, 12> and <T3, C, 1> 4. B

User Icon
-- Apr 4 In-Class Exercise Thread
⟨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.
⟨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.

-- Apr 4 In-Class Exercise Thread
1) Only T1 would be included
2) Right after the <COMMIT T1>
3) Undo the O(B), <T3, C, 1>, <T2, B, 12>
4) <T2, B, 12> would affect the disk
1) Only T1 would be included 2) Right after the <COMMIT T1> 3) Undo the O(B), <T3, C, 1>, <T2, B, 12> 4) <T2, B, 12> would affect the disk

-- Apr 4 In-Class Exercise Thread
 - <START CHKP(T1)>. Transaction 1 would be the only transaction listed because it is the only transaction starts at that point.
 - ⟨END CKPT⟩ could be added between the <COMMIT T1> and O2(B)
 - If a crash occurs, we will be able to undo O2(B), <T2, B, 12> and <T3, C, 1>. 
 - The undoing of the B value will change things on the disk because we originally wrote it to the disk
- <START CHKP(T1)>. Transaction 1 would be the only transaction listed because it is the only transaction starts at that point. - ⟨END CKPT⟩ could be added between the <COMMIT T1> and O2(B) - If a crash occurs, we will be able to undo O2(B), <T2, B, 12> and <T3, C, 1>. - The undoing of the B value will change things on the disk because we originally wrote it to the disk

-- Apr 4 In-Class Exercise Thread
1. <START CKPT(T1)>.
2. Right after <COMMIT T1>.
3. Everything after <START CKPT(T1)> leading up to <END CKPT>, excluding operations involving T1 and operations without angled brackets.
4. B would remain 12 and C would remain 1 on disk.
(Edited: 2018-04-04)
1. <START CKPT(T1)>. 2. Right after <COMMIT T1>. 3. Everything after <START CKPT(T1)> leading up to <END CKPT>, excluding operations involving T1 and operations without angled brackets. 4. B would remain 12 and C would remain 1 on disk.

-- Apr 4 In-Class Exercise Thread
 • 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)
• 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.

-- Apr 4 In-Class Exercise Thread
 1. T1
 2. After <Commit T1>
 3. <T3, C, 1>, <T2, B, 12>. C would go back to 1 and B would go back to 12.
 4. The undo operation B would effect the value B on disk.
(Edited: 2018-04-04)
1. T1 2. After <Commit T1> 3. <T3, C, 1>, <T2, B, 12>. C would go back to 1 and B would go back to 12. 4. The undo operation B would effect the value B on disk.
[ Next ]
X