retagged by
1,009 views
5 votes
5 votes
Assume there are n transactions$:T_{1},T_{2},.,T_{n}.$ Every transaction writes value of $X$ that is read by its successive transaction like $T_{1}$ writes value of $X$ that is read by $T_{2}, T_{2}$ writes a value of $X$ that is read by $T_{3},.., T_{n-1}$ writes a value of $X$ that is read by Tn. Now,if $T_{1}$ fails,then total how many transaction rollbacks are required to recover the schedule?
retagged by

2 Answers

6 votes
6 votes
T1 T2 T3 T4 T5 T6 .....      
W(x)                  
  W(x)                
    W(x) .....            

initially the value of x is 500.

perform operation x=x+500 and value of x is 1000.

this value is read by transaction T2,and that is read by T3 and so on.

if transaction T1 fails,rollback transaction T2,T3,T4.....because the transaction read by T1 is uncomitted so to get correct result T2,T3,T4...rollbacked.

and to get original  value of x=500,transaction T1 also rollbacked.

so finally all 'n' transactions are rolledback.

0 votes
0 votes

T1 writes value of X that is read by T2 

if this line means that a data is written by T1 ,then it is read by T2 and then it writes and then read by T3

so lets consider a daa item X=20

now T1= X+5; then X=25

T2=X+5   x=30

T3=X+5;   x=35

Now if T1 rolls back we have to roll back T2 and like that

so we need N roll backs

Related questions

0 votes
0 votes
0 answers
2
0 votes
0 votes
1 answer
3