Algorithms For Recovery and Isolation Exploiting Semantics - Logging

Logging

For the ARIES algorithm to work a number of log records have to be created during the operation of the database. Log entries are sequentially numbered with Sequence Numbers.

Usually the resulting logfile is stored on so-called "stable storage", that is a storage medium that is assumed to survive crashes and hardware failures. To gather the necessary information for the logging two datastructures have to be maintained: the dirty page table (DPT) and the transaction table (TT).

The dirty page table keeps record of all the pages that have been modified and not yet written back to disc and the first Sequence Number that caused that page to become dirty. The transaction table contains all transactions that are currently running and the Sequence Number of the last log entry they caused.

We create log records of the form (Sequence Number, Transaction ID, Page ID, Redo, Undo, Previous Sequence Number). The Redo and Undo fields keep information about the changes this log record saves and how to undo them. The Previous Sequence Number is a reference to the previous log record that was created for this transaction. Using the Previous Sequence Numbers it is for example possible to traverse to log file in reverse order and undo all the actions of a specific transaction in case it aborts.

Every time a transaction begins or commits we write a Begin Transaction entry or, respectively, an End Of Log entry for that transaction.

During a recovery or while undoing the actions of an aborted transaction a special kind of log record is written, the Compensation Log Record (CLR), to record that the action has already been undone. CLRs are of the form (Sequence Number, Transaction ID, Page ID, Redo, Previous Sequence Number, Next Undo Sequence Number). The Undo field is omitted because that information is already stored in the original log record for that action.

Read more about this topic:  Algorithms For Recovery And Isolation Exploiting Semantics