Author | Message |
---|---|
se1k1h1mawar1
Posts: 121
|
Posted 15:48 Nov 20, 2015 |
Since I was certain that I am still confused about this topic, I tried a couple of different scenarios of crash and failure recoveries (Undo-only and Redo-only logging and recovery). Could anyone please point out any mistakes I made? I think I need a few other sets of eyes or a very skilled set of eyes to do this.
Case 1-a (with Undo Only Logging and Recovery) : -- crash --> Flush(Y) The disk would have these values in the appropriate location after Undo-Only Recovery: Flush(log) The disk would have these values in the appropriate location after the crash: The disk would have these values in the appropriate location after Undo-Only Recovery: ============== Flush(Y) The disk would have these values after Redo Only Recovery: ============== The disk would have these values after Redo Only Recovery: <COMMIT, T2>
The log would look like this after the crash: The disk would have these values after Undo Only Recovery: ==============
The log would look like this after the crash: The disk would have these values after Undo Only Recovery: Last edited by se1k1h1mawar1 at
22:27 Nov 20, 2015.
|
vsluong4
Posts: 87
|
Posted 21:33 Nov 20, 2015 |
For 2-b(redo), I think you're saving to disk before it is committed and "Prerequisite: none of the changes made by uncommitted transactions have been saved to disk"
And you're also trying to change the value of Z after a commit. Someone correct me if I'm wrong, but I don't think you're supposed to do that |
se1k1h1mawar1
Posts: 121
|
Posted 22:26 Nov 20, 2015 |
I completely agree. Thank you for your reply.
|
cysun
Posts: 2935
|
Posted 10:45 Nov 21, 2015 |
Case 1a: cannot be recovered with Undo-only. Because crash happens after <COMMIT,T> and Flush(log), <COMMIT,T> is in the log. The recovery process will think T is already committed so it won't undo T, but in fact Y is not written to disk. Case 1b: can be recovered with Undo-only. The difference between this and 1a is that <COMMIT,T> is not in the log, so the transaction will be undone. Case 2a: can be recovered with Redo-only. Case 2b: this is an invalid sequence: because Write(T,Z,Vz') is before Commit, <UPDATE,T,Z,Vz'> must be before <Commit,T>. Case 3a: can be recovered with Undo-only given the time of the crash, but not Undo-only recoverable in general because <COMMIT,T1> is flushed to the log before all the changes made by T1 are flushed to disk. Case 3b: cannot be recovered with Undo-only because <UPDATE,T2,Z,Vz> is not flushed to disk so change to Z cannot be undone. |
se1k1h1mawar1
Posts: 121
|
Posted 11:23 Nov 21, 2015 |
Thank you for taking the time to look through and reply. I have a lot clearer understanding now. |
jpascua
Posts: 197
|
Posted 15:15 Nov 27, 2015 |
Case 2b: What's wrong with Write(T,Z,Vz') being before Commit? Perhaps I overlooked something in the examples / lecture notes. Last edited by jpascua at
15:16 Nov 27, 2015.
|
cysun
Posts: 2935
|
Posted 21:21 Nov 27, 2015 |
Each log record is generated by an operation in a transaction, e.g. a Write(T,X) operation generates an <Update,T,X> log record and a Commit T operation generates a <COMMIT,T> record. Because of this, the order of the log records must match the order of the operations in the transaction. |
jpascua
Posts: 197
|
Posted 22:41 Nov 27, 2015 |
Makes sense. Thanks for the reply. |