Database log |
In in the field of Databases in computer science, a database log is a history of actions executed by a database management system. Physically, a log is a computer file of records stored in stable storage, designed to withstand crash (computing)es.
== Anatomy of a general database log == A database log record is made up of
= Types of database log records =
All log records include the general log attributes above, and also other attributes depending on their type (which is recorded in the Type attribute, as above).
*Update Log Record notes an update (change) to the database. It includes this extra information:
*Compensation Log Record notes the rollback of a particular change to the database. Each correspond with exactly one other Update Log Record (although the corresponding update log record is not typically stored in the Compensation Log Record). It includes this extra information:
*Commit Record notes a decision to commit a transaction.
*Abort Record notes a decision to abort and hence rollback a transaction.
*Checkpoint Record notes that a checkpoint has been made. These are used to speed up recovery. They record information that eliminates the need to read a long way into the log s past. This varies according to checkpoint algorithm. If all dirty pages are flushed while creating the checkpoint (as in PostgreSQL), it might contain:
*Completion Record notes that all work has been done for this particular transaction. (It has been fully committed or aborted)
= Tables =
These tables are maintained in memory, and can be efficiently reconstructed (if not exactly, to an equivalent state) from the log and the database:
*Transaction Table: The table contains one entry for each active transaction. This includes Transaction ID, and lastLSN, where lastLSN describes the LSN of the most recent log record for the transaction.
*Dirty Page Table: The table contains one entry for each dirty page that haven t been written to disk. The entry contains recLSN, where recLSN is the LSN of the first log record that caused the page to be dirty.
Most current databases, such as , and support this functionality.|
|
