Databases Reference
In-Depth Information
transaction processing, then these problems must be resolved. Before consid-
ering solution options, you need a clear understanding of the nature of these
problems.
In a lost update, an apparently successful database update by one transac-
tion can be overwritten by another transaction. This is one aspect of the prob-
lem you saw in Figure 10-4. T1 updated the database to show 750 books left
in inventory, then T2 updated the same record, changing the number in inven-
tory to 600. This leaves us with an inaccuracy in the TextBookInventory table.
The other problem is that T2 is working with inaccurate data, because the data
changed after it was read, but more on that problem next.
A dirty read, also called an uncommitted dependency (or dependency on
an uncommitted update), is the result of one transaction reading data that is
being modified by a second transaction. For this example, you need to look at
Figure 10-5.
In Figure 10-5, the transaction is filling a customer order. The general flow
for processing the order is as follows:
Locate the items being ordered.
Reduce the quantity on hand for each item.
Figure 10-5
Transaction
T1
Check on hand for item 120
Reduce on hand for 120 by 1000
Check credit for customer 1001
Generate order
Commit transaction
Warehouse Database
Transaction
T2
Check on hand for item 120
Reduce on hand for 120 by 600
Check credit for customer 1040
Generate order
Commit transaction
TextBookInventory
100 Chemistry
120 Physics
310 Intro. To Literature
Customer
1001 Northgate
1040 Westview
1910 Eastland
Dirty read example.
Search WWH ::




Custom Search