next up previous
Next: Total or Partial Rollbacks Up: NORMAL PROCESSING Previous: NORMAL PROCESSING

Updates

If the granularity of locking is a record , then , when an update is to be performed on a record in a page , after the record is locked , that page is fixed in the buffer and latched in the X-mode , update is performed , a log record is appended to the log , the LSN of the log record is placed in the page-LSN field of the page and in the transaction table , and the page is unlatched and unfixed. The page latch is held during the call to the logger. The data page latch is not held while any necessary index operations are performed. When more than one log record's are required to undo/redo the update operation :

  1. The undo-only log record should be written before the redo-only log record is written , and
  2. the LSN of the redo-only log record should be placed in the page-LSN field.
Sometimes, the identity of the record to be modified or read may not be known before a page is examined. In such cases, the record lock must be obtained after the page is latched. To avoid waiting for a lock while holding a latch , which could lead to an undetected deadlock, the lock is requested conditionally and if it is not granted ,then the latch is released and the lock is requested unconditionally. If the lock is now granted , the page is latched again and any previously verified conditions are rechecked. If the conditions are still found to be satisfied , then the update is performed. If the granularity of locking is a page or something coarser than a page , then there is no need to latch the page since the lock on the page will be sufficient to isolate the executing transaction. To support unlocked or dirty reads , then , even with page locking , a transaction that is updating a page should be made to hold the X-latch on the page so that readers who are not acquiring locks are assured physical consistency if they hold an S latch while reading the page. Unlocked reads can also be performed by the image copy utility.


next up previous
Next: Total or Partial Rollbacks Up: NORMAL PROCESSING Previous: NORMAL PROCESSING

Vinay V
Mon Apr 12 18:36:08 IST 1999