Record versions as an undo log

<< The Firebird server and VARCHARs | Database technology articles | Request handles >>

Record versions as an undo log

By Ann Harrison

Firebird has no undo log or before-image journal. Instead, it uses old record versions to back out changes of transactions that fail.

When a record is changed or deleted, the system creates a back version of the record that contains enough information to transform the newer version into the previous version. The newest record version contains a link to the next older version, which may contain a link to the next older version, and so on. However, there is, at most, one uncommitted version of each record.

When a transaction rolls back, the next older version of each record it changed is the undo log for that record. A transaction that rolls back under program control undoes its own actions. If the transaction cannot undo its own actions, its changes are undone through cooperative garbage collection. When a transaction encounters a record version created by a transaction that failed, the active transaction removes that record version and replaces it with the previously committed version of the record.

This article was written by Ann Harrison and is copyright Ms. Harrison and IBPhoenix Inc. You may republish it verbatim, including this notation. You may update, correct, or expand the material, provided that you include a notation that the original work was produced by Ms. Harrison and IBPhoenix Inc.

See also:
OAT (Oldest Active Transaction) OIT (Oldest Interesting Transaction)

back to top of page
<< The Firebird server and VARCHARs | Database technology articles | Request handles >>