Failure Recovery
Introduction
Undo Logging
Undo logs, as indicated by its name, undo changes to the databse to restore previous state of the database to keep it consistent. Once a transaction is committed, it should not be undone because it has been confirmed. The undo log records the value before the tuple in the database is changed: LOG<T, tuple, prev_value>
Logging Rules
- log record is written to disk before the actual database change is written to disk
- commit log is written to disk after all changes specified in the transaction is written to disk
Recovery Procedure
- Uncommitted transactions are undone in the reverse order
Redo Logging
Rodo logs, as indicated by its name, redo changes to the database to make sure incomplete changes are properly updated, so that the state of the database is consistent. The redo log records the value after the tuple in the database is changed: LOG<T, tuple, after_value>
Logging Rules
- all logs (including commit logs) are written to disk before any actual database change is written to disk
Recover Procedure
- Committed transactions are redone in order
Undo Redo Logging
- a log for a specific modification should be written to disk before this change is writtent to disk
Note
The first rule specify that as long as the change is written to the disk after its corresponding log, then it is fine. This means the change to the database can be written to disk even after the commit log