Information Technology Reference
In-Depth Information
3.6
Updating a Data Page
We assume that log records are appended to the log by the call
log .n; h ::: i /.
The call write-latches the current tail of the log, determines the LSN for the log
record, appends the log record to the log buffer, releases the latch, and assigns the
LSN to the output parameter variable n.
In the following we consider briefly the implementation of forward-rolling
actions IŒx; v and DŒx; v , as regards data page updating, latching, and logging,
omitting aspects related to transactional concurrency control (locking).
In executing IŒx; v , the data page p that will receive the tuple .x; v / is first
located and write-latched. For example, if the physical database structure is a sparse
B-tree, we have to locate the leaf page p whose key range covers the key value x.
We assume that locating the data page p also includes any structure modifications
(page splits) that must be done so as to arrange sufficient space in the page for the
tuple to be inserted. When the server-process thread that services transaction T has
located, fixed, and write-latched data page p, the insertion is performed, after which
page p is unlatched:
1. Locate and write-latch the data page p that will receive .x; v /.
2. insert-into-page .T;p;x; v /.
3. unlatch-and-unfix .p/.
Here the call insert-into-page .T;p;x; v / (Algorithm 3.1 )inserts.x; v / into page
p, logs the insertion with the redo-undo log record ( 3.9 ), stamps the LSN of the
log record into the P AGE -LSN field of page p, and updates the U NDO -N EXT -LSN of
transaction T in the active-transaction table.
In executing DŒx; v , the data page p that holds the tuple with key value x
is first located and write-latched. We assume that this also includes any structure
modifications that must be done so as to arrange that a sufficient number of tuples
will remain in page p after the deletion of .x; v / (in order to maintain the balance
condition, if any). When the server-process thread that services transaction T has
located, fixed, and write-latched data page p, the deletion is performed, after which
page p is unlatched:
1. Locate and write-latch the data page p that contains the tuple with key x.
2. delete-from-page .T;p;x/.
3. unlatch-and-unfix .p/.
Here the call delete-from-page .T;p;x/ (Algorithm 3.2 ) deletes the tuple with
key x from page p, logs the deletion with the redo-undo log record ( 3.10 ), stamps
the LSN of the log record into the P AGE -LSN field of page p, and updates the U NDO -
N EXT -LSN of transaction T .
Search WWH ::




Custom Search