Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Original Transaction Log Flush/Sync Behavior

While a transaction is pending (prior to its commit), changes made to data files are held in user-specific memory called preimage space. When the transaction commits, the changes are copied from preimage space to c‑tree’s data cache.

Updates to key values for transaction-controlled files are performed immediately during a transaction. The key values are marked to indicate that the changes are pending commit. These key-level marks allow the transactor (the connection that is executing the transaction) to see the updated key values as active, while other connections see the updated key values as pending (not yet committed).

When a transaction commits, c‑tree writes to the transaction log and data files in this order:

  1. Write transaction log entries to disk. An ENDTRAN entry in the log signifies that all the log entries for that transaction are on disk. c‑tree ensures that the log entries for the transaction are both flushed from c‑tree’s transaction log buffer to the file system cache and synced from the file system cache to disk. When the transaction commit call returns to the caller, the existence of the transaction log entries on disk guarantees that the transaction is recoverable.
  2. Write data file updates to c‑tree’s data cache and/or to disk. Depending on the options that are in effect for the file or for the database engine, this step will either write the data file updates to c‑tree’s data cache or write the changes to file system cache or to disk. It is not required that the changes to the data files are on disk when the transaction commits, because the transaction log entries can be used to redo the transaction if c‑tree terminates abnormally before the updates to the data files are known to be on disk (which can be sometime after the transaction commits).
  3. Mark the transaction as completed. This step causes other connections to view the key level locks as committed rather than pending commit.
  4. Unlock records. This step allows other connections to lock and update the records that the transaction touched, if desired.

Transaction Processing

TOCIndex