Information Technology Reference
In-Depth Information
To perform a total rollback of T , the chain starting from the log record with LSN
D U NDO -N EXT -LSN .T / is traversed back to the begin-transaction log record of T ;at
each log record on the chain, the corresponding action is undone (either physically
or logically). To perform a partial rollback to a savepoint, the U NDO -N EXT -LSN chain
is traversed back to the log record written for the set-savepoint action.
In the redo pass of restart recovery (Sect. 4.8 ), the updates by transactions
that were not written to disk before the failure are redone on disk versions of
database pages. The redo pass is followed by the undo pass (Sect. 4.9 ), in which
forward-rolling transactions are aborted and rolled back, and the rollback of
backward-rolling transactions is completed by performing the undo actions of the
not-yet-undone forward-rolling update actions.
3.2
Physiological Logging
Logging schemes can be classified into physical, logical, and physiological. In
physical logging ,or value logging , the log record for an update includes the page-id
of the page being updated, the location of the bytes that were changed in the page,
and the before and after images of the update. The before image gives the contents
of the bytes before the update, and the after image gives the contents of the bytes
after the update.
For example, when inserting tuple .x; v / into page p at record position i ,the
changed bytes at the position of the i th record in the record area of p are written to
the log, as well as the changed bytes in p's record index (at entry i ) and those in p's
header (in the field storing the total number of items stored in the record index). The
changed byte sequences with their addresses (byte offsets from the start of the page)
can all be written into one log record, if it fits on one page (as we will assume).
An update action logged with a physical log record can be redone by fixing and
write-latching the page in question and writing the after image onto it. An operation
can be undone by writing the before image.
In logical logging , the log records contain logical actions, that is, actions
WŒx; u ; v and W 1 Œx; u ; v in the read-write model and, additionally, actions
IŒx; v , DŒx; v , I 1 Œx; v ,andD 1 Œx; v in the key-range model. For example, a
forward-rolling insertion of tuple .x; v / by transaction T would be logged with
n Wh T; I; x; v ;n 0 i ,
where n 0 is the U NDO -N EXT -LSN of T .
A logical action is redone by performing the operation again (logically) and
undone by performing the undo action (logically). Logical logging makes sense
for a main-memory database , that is, a database that is kept in main memory all the
time; its physical structure thus need not be composed of disk-page-size nodes. The
contents of a main-memory database are periodically checkpointed into the log,
and in the event of a failure, the database is initialized from the latest checkpoint
whose log record is found on the log disk. The updates done by transactions after
Search WWH ::




Custom Search