At the end of the redo phase t 1 would get added to

Info icon This preview shows pages 4–7. Sign up to view the full content.

View Full Document Right Arrow Icon
recovery algorithm. At the end of the redo phase, T 1 would get added to the undo-list, and the value of A would be 2000. During the undo phase,
Image of page 4

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

View Full Document Right Arrow Icon
Practice Exercises 19 since T 1 is present in the undo-list, the recovery algorithm does an undo of statement 2 and A takes the value 1000. The update made by T 2 , though commited, is lost. The correct sequence of logs is as follows: 1. < T 1 start> 2. < T 1 , A, 1000, 900> 3. < T 1 , A, 1000> 4. < T 1 abort> 5. < T 2 start> 6. < T 2 , A, 1000, 2000> 7. < T 2 commit> This would make sure that T 1 would not get added to the undo-list after the redo phase. 16.8 Disk space allocated to a file as a result of a transaction should not be released even if the transaction is rolled back. Explain why, and explain how ARIES ensures that such actions are not rolled back. Answer: If a transaction allocates a page to a relation, even if the transac- tion is rolled back, the page allocation should not be undone because other transactions may have stored records in the same page. Such operations that should not be undone are called nested top actions in ARIES . They can be modeled as operations whose undo action does nothing. In ARIES such operations are implemented by creating a dummy CLR whose Un- doNextLSN is set such that the transaction rollback skips the log records generated by the operation. 16.9 Suppose a transaction deletes a record, and the free space generated thus is allocated to a record inserted by another transaction, even before the first transaction commits. a. What problem can occur if the first transaction needs to be rolled back? b. Would this problem be an issue if page-level locking is used instead of tuple-level locking? c. Suggest how to solve this problem while supporting tuple-level locking, by logging post-commit actions in special log records, and executing them after commit. Make sure your scheme ensures that such actions are performed exactly once. Answer: a. If the first transaction needs to be rolled back, the tuple deleted by that transaction will have to be restored. If undo is performed in the usual physical manner using the old values of data items, the space allocated to the new tuple would get overwritten by the transaction
Image of page 5
20 Chapter 16 Recovery System undo, damaging the new tuples, and associated data structures on the disk block. This means that a logical undo operation has to be performed i.e., an insert has to be performed to undo the delete, which complicates recovery. On related note, if the second transaction inserts with the same key, integrity constraints might be violated on rollback. b. If page level locking is used, the free space generated by the first transaction is not allocated to another transaction till the first one commits. So this problem will not be an issue if page level locking is used. c. The problem can be solved by deferring freeing of space till after the transaction commits. To ensure that space will be freed even if there is a system crash immediately after commit, the commit log record can be modified to contain information about freeing of space (and other similar operations) which must be performed after commit.
Image of page 6

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

View Full Document Right Arrow Icon
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern