TMF Introduction (G06.26+)
TMF Overview
HP NonStop TMF Introduction—522414-002
1-5
Database Consistency
Database Consistency
When you design a database, you establish criteria for the relationships among its
data; for example, an account balance must equal credits to the balance minus debits
to the balance. When the database satisfies these criteria, the database is considered
to be consistent.
The changes a transaction makes to a database should transform the database from
one consistent state to a new consistent state. The changes, however, can make the
database inconsistent at points during the transformation. For example, consider
transaction T1 that transfers $500 from a savings account to a checking account, as
shown in Figure 1-3.
The database is inconsistent after the debit on savings (Operation 1) but before the
credit on checking: at that moment, the database violates the criteria for balancing
accounts because the $500 debited is not represented. After the credit (Operation 2),
the database is consistent again.
TMF provides database consistency by ensuring either that all the operations in the
transaction are applied to the database as a unit or that none of the operations affect
the database. An application delimits the operations of a transaction with logical begin
and end transaction statements, thus defining the TMF transaction. With the
transaction defined, TMF treats all operations in the transaction as a unit.
Figure 1-3. Database Consistency in a Banking Transaction
BEGIN T1
Transfer $500 from
SAVINGS to CHECKING
Operation 1
Debit SAVINGS $500
Operation 2
Credit CHECKING $500
END T1
Balance
$4500
$4000
$4000
Balance
$50
$50
$550
State of Database
Consistent
Inconsistent
Consistent
SAVINGS CHECKING
VST003.vsd