An application, which uses multiple files,
may require multiple actions
in order to record information for a single event. For example,
an order entry system, where an order is placed for an item
must be reflected in files containing the following types of data:
If this data is in separate files, each file must be updated with a
separate call to FWRITE. If the shipping data was updated,
but a program abort or system failure occurred before the accounts
receivable was updated, then the order might be shipped but never
billed. Depending upon the point at which the failure occurred, other
files may have inconsistencies in their data such as:
The item may be shipped, but still be included in inventory.
The inventory may be reduced, but cost of goods sold was
not increased.
The collection of all actions (such as, calls to FWRITE)
which must be complete, in
order for all data involved to be consistent, will be referred to as
a single transaction. A transaction is complete only after all
of these actions are completed.
This type of application may utilize User Logging to record
information about each action which makes up the transaction.
The log record could contain information about the transaction
and the user could then write a recovery program to reapply to the
backup copies of the data structures, the changes for those
transactions which completed. This recovery program would not reapply
changes which were part of transactions, that did not fully
complete. This ensures the preservation of data integrity
through a program abort or system failure.