Write Ahead Log

What
The write ahead log is an implementation of logging that the DBMS uses to enforce atomicity and durability. Its structure can be summarized by WAL Logging Framework

Protocol

 * 1) Must force the log record for an update before the corresponding data page gets to disk
 * 2) Must force all log records for a transaction before commit

LSN

 * Lsn.png log record has a unique log sequence number
 * Each data page has a pageLSN, the LSN of the most recent log record for an update to that page
 * System keeps track of systemLSN, the LSN of the most recent log record flushed to stabl? Insert/Remove Bulleted Liste log

Rules

 * 1) Write_ahead_log_rule_1.png a given page "i" to be written out to disk, we must flush the log to the point where $$\textrm{pageLSN}_i \leq flushLSN$$

Other Data Structures
There are a few other in memory tables that are necessary for the operation of the log to be successful

Transaction Table
This table holds information about all active transactions. The table has the following attributes:
 * XID - Transaction ID
 * status - {running, committing, aborting}
 * lastLSN - the most recent LSN that was created

Dirty Page Table
This table holds information about dirty pages currently in the buffer pool. The table has the following attributes:
 * recLSN - the first LSN that caused the page to be considered dirty

Examples

 * Example: Normal Transaction Execution
 * Example: Transaction Commit
 * Example: Transaction Abort