A give an example to show that using the normal

Info iconThis preview shows pages 7–8. Sign up to view the full content.

View Full Document Right Arrow Icon
a. Give an example to show that using the normal transaction undo mechanism to undo such a transaction could lead to an inconsistent state. b. One way to handle this situation is to bring the whole database to a state prior to the commit of the erroneous transaction (called point-in-time recovery). Transactions that committed later have their effects rolled back with this scheme. Suggest a modiFcation to the recovery algorithm of Section 16.4 to implement point-in-time recovery using database dumps. c. Later nonerroneous transactions can be re-executed logically, if the updates are available in the form of SQL but cannot be re-executed using their log records. Why? Answer: a. Consider the a bank account A with balance $100. Consider two transactions T 1 and T 2 each depositing $10 in the account. Thus the balance would be $120 after both these transactions are executed. Let the transactions execute in sequence: T 1 Frst and then T 2 . The log records corresponding to the updates of A by transactions T 1 and T 2 would be < T 1 , A , 100 , 110 > and < T 2 , A , 110 , 120 > resp. Say, we wish to undo transaction T 1 . The normal transaction undo mechanism will replacesthe valuein question— A in this example— by the old-value Feld in the log record. Thus if we undo transaction T 1 using the normal transaction undo mechanism the resulting bal- ance would be $100 and we would, in effect, undo both transactions, whereas we intend to undo only transaction T 1 . b. Let the erroneous transaction be T e . Identify the latest archival dump, say D , before the log record < T e , START > . Restore the database using the dump. Redo all log records starting from the dump D till the log record < T e , COMMIT > . Some transaction—apart from transaction T e —would be active at the commit time of transaction T e . Let S 1 be the set of such transactions. Rollback T e and the transactions in the set S 1 . This completes point-in-time recovery. In case logical redo is possible, later transactions can be rex- ecuted logically assuming log records containing logical redo
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
22 Chapter 16 Recovery System information were written for every transaction. To perform log- ical redo of later transactions, scan the log further starting from the log record < T e , COMMIT > till the end of the log. Note the transactions that were started after the commit point of T e . Let the set of such transactions be S 2 . Re-execute the transactions in set S 1 and S 2 logically. c. Consider again an example from the Frst item. Let us assume that both transactions are undone and the balance is reverted back to the original value $100. Now we wish to redo transaction T 2 . If we redo the log record < T 2 , A , 110 , 120 > corresponding to transaction T 2 the balance would become $120 and we would, in effect, redo both transactions, whereas we intend to redo only transaction T 2 .
Background image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page7 / 8

a Give an example to show that using the normal transaction...

This preview shows document pages 7 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online