Consider aserial schedule <T 0 ,T 1 ,T 2 > which involves 3 data items A, B, C w
ID: 3777460 • Letter: C
Question
Consider aserial schedule <T0,T1,T2> which involves 3 data items A, B, C with initial value 1000, 2000, 800, respectively. Assuming the sytem has crashed, for any of the following log files, state the corresponding recovery plan (i.e list the transactions needed to be undone and redone in order and for each transacton T, state the values of the data items that are involved in the transaction T after the undone and redone operation)
a. <T0,start>, <T0, A, 1000, 900>, <T0, B, 2000, 2100>
b. <T0, start>, < T0, A, 100, 900>, <T0, B, 2000, 2100>, <T0, commit>, < T1, start>, <T1, C, 800, 900>
c. <T0, start>, <T0, A, 1000, 900>, < T0, B, 2000, 2100>, <T0, commit>, <T1, start>, <T1, C, 800, 900>, <T1, commit>, <T2, C, 900, 1000>
d. <T0, start>, <T0, A, 900>, <T0, B, 2100>
e. <T0, start>, < T0, A, 900>, <T0, B, 2100>, <T0, commit>, <T1, start>, <T1, C, 900>, <T1, commit>, <T2, C, 900,1000>
Explanation / Answer
a. <T0,start>, <T0, A, 1000, 900>, <T0, B, 2000, 2100>
--> Since T0 has not committed yet and the system crashed , So Undo (T0) needs to be done since <T0,start> is present : Recovery Plan : Undo (T0) , Values of A , B , C are still the same as 1000,2000,800
b. <T0, start>, < T0, A, 1000, 900>, <T0, B, 2000, 2100>, <T0, commit>, < T1, start>, <T1, C, 800, 900>
T0 is committed and T1 has started , So Redo (T0) needs to be done since <T0, commit> is present and
Undo (T1) needs to be done since <T1,start> is present : Recovery Plan : Redo (T0) , Undo (T1)
After Redo(T0) and Undo(T1), A has 900, B = 2100 , C = 800
c.<T0, start>, <T0, A, 1000, 900>, < T0, B, 2000, 2100>, <T0, commit>, <T1, start>, <T1, C, 800, 900>, <T1, commit>, <T2, C, 900, 1000>
T0, T1 is committed and T2 has not started/committed , so Recovery Plan : Redo (T0) , Redo (T1) , we dont have do anything for T2 because there is no <T2, start> or <T2,commit>
So after redoing T0 and T1 values of A, B, C are 900,2100, 900
d. <T0, start>, <T0, A, 900>, <T0, B, 2100>
Since T0 has not committed yet and the system crashed , So Undo (T0) needs to be done since <T0,start> is present : Recovery Plan : Undo (T0) , Values of A , B , C are still the same as 1000,2000,800
Note : < T0, A, 900> : Means irrespective of what A value is , Just make A as 900.
e. <T0, start>, < T0, A, 900>, <T0, B, 2100>, <T0, commit>, <T1, start>, <T1, C, 900>, <T1, commit>, <T2, C, 900,1000>
T0, T1 is committed and T2 has not started/committed , so Recovery Plan : Redo (T0) , Redo (T1) , we dont have do anything for T2 because there is no <T2, start> or <T2,commit>
So after redoing T0 and T1 values of A, B, C are 900,2100, 900
Thanks, I hope it clarifies