Skip to content
UoL CS Notes

Checkpoints

COMP207 Lectures

By making checkpoints we can enable faster recovery and make the log files use less space.

Simple Checkpointing

This method is applicable for undo logging.

The idea is that we checkpoint the log periodically:

  • Every $m$ minutes or after $t$ transaction since the last checkpoint.
  • No need to undo transactions before the checkpoint.

The part before the checkpoint can be discarded from the log.

Procedure

  1. Stop accepting new transactions
  2. Wait until all active transactions finish and have written COMMIT or ABORT record to the log.
  3. Flush the log to disk.
  4. Write a log record <CHECKPOINT>.
  5. Flush the log to disk again.
  6. Resume accepting transactions.

Recovery with Simple Checkpoints

To complete recovery just step back through the undo log up to the checkpoint just as before.

ARIES Checkpoints

This style of checkpoints has the following two requirements:

  • Undo/redo logging is used.
  • Transactions do not write to buffers before they are sure they want to commit.

Procedure

  1. Write <CHECKPOINT(T1, T2,…)> in log and flush it.
    • T1, T2,… are the transaction in progress (i.e. not committed and not aborted).
  2. Write the content of the buffer to disk (i.e. output).
  3. Write <END CHECKPOINT> in log and flush it.

Recovery with ARIES Checkpoints

This is the same as recovering with an undo/redo log except:

  • Only redo part of committed transactions in T1,T2,… after <CHECKPOINT(T1,T2,…)>.
  • Then undo all of uncommitted transactions in T1,T2,… including before <CHECKPOINT(T1,T2,…)>.

You must stop after having found a <CHECKPOINT(T1,T2,…)> with corresponding <END CHECKPOINT> and <START Ti> for all mentioned transactions that are uncommitted.