NonStop Systems Introduction
Transaction Management
NonStop Systems Introduction—527825-001
5-2
What Is a TMF Transaction?
Figure 5-1 on page 5-2 shows how a failure during the processing of a money-transfer
transaction could cause the database to become inconsistent. In this example, the
customer transfers $1000 from a $5000 savings account to a $50 checking account.
When the transaction ends, the customer should have $4000 in the savings account
and $1050 in the checking account.
Note that if a failure occurs after the transaction has debited the savings account by
$1000 but before it has credited the checking account with $1000, the database is
inconsistent because the checking account record no longer has a correct relationship
with the savings account record. The decrease in the savings balance is not matched
by an increase in the checking balance.
This is where TMF plays an important role. It ensures that a group of update
operations gets applied as one logical unit of work. Either they all happen or none of
them happen. TMF takes the concept of a transaction as a group of computer
operations and redefines it as a single unit of work that is recovered as a whole in the
event of a failure.
For example, if a failure interrupts the money-transfer transaction at the point shown in
Figure 5-1, TMF backs out the change made to the savings account record. That is, it
cancels the new savings balance by restoring the old balance. As a result, the
database looks exactly the way it looked before the transaction started. It shows
$5000 in the savings account and $50 in the checking account. The database is back
in a consistent state because the savings account record and the checking account
record agree with each other.
When the transaction is redone and successfully completed, it puts the database in a
new consistent state, where the savings balance is $4000 and the checking balance is
Figure 5-1. Money-Transfer Transaction
Money-transfer transaction
Database records
Transaction begins
Savings balance Checking balance
Savings account debited
$1000
Checking account credited
$1000
Transaction ends
$5000
$4000
$4000
$4000
$50
$50
$1050
$1050
Failure point
VST056.vdd