Transactions - Write-Ahead Logging (Rollback journal) - WAL

> (Data|State) Management and Processing > Data Properties and Transactions

1 - About

Write-Ahead Logging (WAL) is a rollback journal implementation.

This implementation writes change directly to the rollback journal whereas the traditional rollback journal writes changes to the original database.

This rollback journal implementation has become the more prominent one because it enables non-blocking read and write.

Advertising

3 - Process

The WAL is designed for crash recovery purposes.

It represents a ledger of the changes the database plans to make to the database file (tables, indexes,…)

After a crash (or not), when the daemon first starts up, the process compares:

  • the data in the WAL.
  • the data in the database file.

to perform a sort of replication. It will:

  • rolls back any database file that is not committed in the WAL
  • apply any change on the database file that is committed in the WAL but isn’t in the database file

4 - Implementation

The Write-Ahead log implements transactions atomicity by:

  • preserving the original data
  • appending the changes into a separate WAL file.
  • commiting occurs by appending a special record into the WAL.
Advertising

5 - Non blocking - Read Write

As the COMMIT occurs without writing to the original database, Read and write can then occurs simultaneously. Ie:

  • Read from the original database
  • and write to the WAL

This means that :

6 - Documentation / Reference

data/property/wal.txt · Last modified: 2019/05/03 15:01 by gerardnico