Information Technology Reference
In-Depth Information
and the page p 0 that contains the key x 0 next to x, and releasing the short-duration
Xlockonx 0 :
insert-into-page .T;p;x;y; v /
unlatch-and-unfix .p; p 0 /
unlock .T; x 0 ; X; short-duration/
insert-index-record .T;y;x;p/
Here the call insert-index-record .T;y;x;p/ inserts the index record .y;x;p/ into
the secondary index and logs the insertion with a redo-undo log record in the
name of transaction T . The logic of the call is similar to that of the plain call
insert .T;x;y; v / without the secondary-index update; it includes a traversal of the
secondary index for locating the index page that will hold the index record .y;x;p/,
with any structure modifications needed to accommodate the insertion, and, with
key-specific locking, the acquisition of the secondary-key-specific commit-duration
Xlockon.r;Y;y/and the short-duration X lock (or IX lock) on .r;Y;y 0 /,wherey 0
is the key next to y in secondary-key order.
Observe that because the latch on the data page p is released before the index
record is inserted, it may happen that the tuple .x; y; v / no longer resides in page
p when the index record carrying that page-id arrives at the secondary index. We
have no other option than releasing the latch on p, because, if key-specific locking is
used, the insertion of the index record involves acquiring the secondary-key-specific
locks, which may cause lock waits, which are only allowed if no latches are held.
Inserting a tuple .x; y; v / by transaction T generates the pair of redo-undo log
records:
n 1 : h T; I; p; x; y; v ;n 0 i
n 2 : h T; ix-I ;q;y;x;p;n 1 i
where p is the page-id of the data page that received the tuple .x; y; v /,andq is
the page-id of the leaf page of the secondary index that received the index record
.y;x;p/. The action name ix-I denotes the action of inserting an index record into
the secondary index. If the transaction rolls back, the following pair of redo-only
log records is written:
n 3 : h T; ix-I 1 ;q 0 ;y;x;n 1 i
n 4 : h T; I 1 ;p 0 ;x;n 0 i
Here q 0 is the page-id of the leaf page that holds the index record .y;x;p/ and p 0
the page-id of the data page that holds the tuple .x; y; v /, at the time the undo actions
are performed.
11.3
Index Construction Without Quiescing Updates
We now tackle the problem of constructing a secondary index for a relation
r.X;Y;V/ during normal transaction processing when transactions are allowed
concurrent access to the relation. First we note that a trivial solution is obtained
Search WWH ::




Custom Search