Zephyr
Zephyr

Reputation: 1621

Recoverable vs Non recoverable schedule

Consider Schedule 1 as

    T1                      T2
    R(A)
    A=A-50
    W(A)
                            R(A)
                            A=A+20
                            W(A)
                            Commit

   R(B)
   //Failure happens here 
   //and T1 Rollbacks
   B=B+50
   Commit

Consider Schedule 2 as

    T1                      T2
    R(A)
    A=A-50
    W(A)
                            R(A)
                            A=A+20
                            W(A)

   R(B)
   //Failure happens here 
   //and T1 Rollbacks
   B=B+50
   Commit

                        Commit

If the initial value of A=100 then in both the cases value of A will be 100 at the end so how 1st schedule is non recoverable and 2nd one is recoverable?

Also in 1st schedule, the transaction T1 rolls back the value of A after the transaction T2 has committed it. So will the committed value of A also rollback to 100?

Upvotes: 1

Views: 7991

Answers (1)

fool
fool

Reputation: 80

Also in 1st schedule, the transaction T1 rolls back the value of A after the transaction T2 has committed it. So will the committed value of A also rollback to 100?

Yes it will rollback to its initial value

A recoverable schedule is one where, for each pair of transactions Ti and Tj such that Tj reads a data item previously written by Ti, the commit operation of Ti appears before the commit operation of Tj .

* Recoverable schedule = Rollbacking of uncommited transaction * and

* Non-recoverable schedule = Rollbacking of commited transaction *

Upvotes: 1

Related Questions