Information Technology Reference
In-Depth Information
The reading of the value of Cursor is protected by a read latch kept just for
the instant of reading. The querying of the state of the index is protected by
a short-duration read latch on the system-catalog page that contains the index
information.
After inserting the tuple .x; y; v / into data page p and logging the insertion,
Algorithm 11.2 performs the actions specific to the secondary index. Depending on
the state of the index and the position of Cursor , there are four cases:
Case (1). The index is under construction and the extraction process has advanced
past primary key x. In this case the record . ix-I ;y;x;p/is appended into the side
file and the log records
n 1 : h T; I; p; x; y; v ;n 0 i
n 2 : h T; append-to-side-file ;q; ix-I ;y;x;p;n 1 i
are
written,
where q
is
the
page-id
of
the
side-file
page
that
receives
. ix-I ;y;x;p/.
Case (2). The index is under construction but the extraction process has not
advanced past x. Then the log records
n 1 : h T; I; p; x; y; v ;n 0 i
n 2 : h T; no-append-to-side-file ; ix-I ;y;x;p;n 1 i
are written.
Case (3). The index is available. Then the index record .y;x;p/ is inserted into
the secondary index and the log records
n 1 : h T; I; p; x; y; v ;n 0 i
n 2 : h T; ix-I ;q 0 ;y;x;p;n 1 i
are written, where q 0 is the page-id of the index leaf page that receives .y;x;p/.
Case (4). The index is neither available nor under construction, that is, does not
exist at all. Then only the log record
n 1 : h T; I; p; x; y; v ;n 0 i
is written.
Next we turn to the question of what is involved in undoing the above secondary-
index-specific actions should the transaction T perform a total or partial rollback.
In cases (1) and (2), we must check whether the index has become available in the
interim and, in case (2), if the index is not yet available, whether the extraction
process has advanced past key x.
In case (1), if the index has become available, the index constructor has processed
the side file and inserted the record .y;x;p/ to the index; therefore, the append-to-
side-file action is undone by traversing the index in search for .y;x;p/, deleting it,
and logging the deletion with the redo-only log record
n 3 : h T; q 0 ; ix-I 1 ;y;x;p;n 1 i ,
Search WWH ::




Custom Search