Information Technology Reference
In-Depth Information
For example, the allocation of a new page q as part of a heap file structure could
be logged as the following system-generated structure-modification transaction :
h S; B i .
h S; allocate-page-for-heap ;s;f;p;q i .
h S; C i .
Here S is a new transaction identifier generated by the database management
system. When the structure modification is recorded as committed, it can no longer
be rolled back, that is, it behaves as a committed transaction.
However, for reasons of efficiency, we do not require full transaction semantics
from a structure modification. The full semantics would require forcing the log onto
disk, which we want to avoid.
If all of the actual physical database operations in a structure modification can
be logged into one log record, it is not necessary to produce a transaction identifier
or to log the begin or finish of the transaction. Thus, only the following record is
logged for a structure modification that allocates a new page in a heap structure:
n Wh allocate-page-for-heap ;s;f;p;q i :
(3.14)
The LSN n of the log record is stamped into the P AGE -LSN fields of all the affected
pages, s; f; p; q, while holding those pages write-latched.
Example 3.3 Assume that the actions of the transactions
T 1 D BI Œx; v AI 1 Œx; v C
and
T 2 D BI Œy; w C
are executed in the left-to-right order
AI 1 Œx; v C
T 1 W BI Œx; v
T 2 W BI Œy; w C
Also assume that the action IŒx; v causes a new page to be allocated where the
tuple .x; v / is inserted. Then the following will be written to the log:
n 1 : h T 1 ;B i .
n 2 : h allocate-page-for-heap ;s;f;p;q i .
n 3 : h T 1 ;I;q;x; v ;n 1 i .
n 4 : h T 2 ;B i .
n 5 : h T 2 ;I;q;y; w ;n 4 i .
n 6 : h T 2 ;C i .
n 7 : h T 1 ;A i .
n 8 : h T 1 ;I 1 ;q;x;n 1 i .
n 9 : h T 1 ;C i .
The log record with LSN n 2 does not belong to any transaction. It is a redo-only log
record that is only used to redo the effect of the allocation on one or more of the
four pages s; f; p; q affected should the effect of the allocation, due to a failure, be
missing from some of those pages. The U NDO -N EXT -LSN value n 1 in T 1 's log record
with LSN n 3 skips over that with LSN n 2 to T 1 's previous log record (with LSN n 1 ).
Search WWH ::




Custom Search