Skip to content

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

  1. log record is written to disk before the actual database change is written to disk
  2. commit log is written to disk after all changes specified in the transaction is written to disk

Recovery Procedure

  1. 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

  1. all logs (including commit logs) are written to disk before any actual database change is written to disk

Recover Procedure

  1. Committed transactions are redone in order

Undo Redo Logging

  1. 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

Back to top