You are on page 1of 2

b)

Analysis phase Active Transactions=T2 and T3 Looser Transactions=T2 and T3 Dirty Pages=P1, P3,P5 Why T1 is aborted? Not because of the system crash. When a transaction is aborted its updates have to be rollback. To rollback the updates follow the bellow rules. Get the last LSN of T from transaction table Follow the chain of log records backward via prevLSN value in the current log record. Before starting UNDO write CLR. At the end of UNDO, write and END log record.

At LSN=30, Transaction T1 is aborted and so there is a CLR entry at the LSN=40(CLR: UNDO T1 LSN =10), because the transaction table would give T1 as the active transaction. After the UNDO there is another CLR entry at LSN=45(T1 END) Since, T2 has modified P2 and P5 and T3 has modified page P1.Therefore P1, P2 and P3 become dirty pages.

Redo Phase The REDO Phase notice that the smallest value of recLSN of all pages in the dirty page table .In this example P5 will have the most resent LSN (recLSN) value. 60 in the dirty page table, because the update of this page is closer to the point of crash. Then P1 and P3 are found as the pages whose updates have to be redone. Undo Phase TOUNDO= {LSN =50, LSN=60} Selecting the largest LSN value from this set gives us LSN=60 ,(because UNDO must start in most recent LSN log entry).The page P5 is undone ,and then P1 and P3 are undone. For an each undo make an entry in to log. This completes the recovery process.

You might also like