Databases Reference
In-Depth Information
Verify customer credit.
Finalize the order and commit the transaction.
Item 120 has 1100 units on hand before transactions T1 and T2 start pro-
cessing. Textbook quantities are reduced by the amount ordered by customer
1001. For item 120, it is reduced by 1000 copies, leaving 100 on hand. In
T2, the application checks inventory levels for customer 1040's order and
finds that there are insufficient copies to fill the order. This is a dirty read
because the change made by T1 has not been committed. The line item for
item 120 is canceled out due to insufficient quantity to fill the order. After
this happens, in T1, it is determined that customer 1001 has insufficient
credit, so all of the changes to TextBookInventory made by T1 are rolled back.
However, this happens too late to fill those items for customer 1040. The cus-
tomer doesn't get the topics, and the company possibly loses a sale, because
of a dirty read.
A nonrepeatable read is also referred to as inconsistent analysis. This
occurs when one transaction is reading a table multiple times while another
transaction is modifying the same table. Take a look in Figure 10-6.
Figure 10-6
Transaction
T1
Read all TextBookInventory
Check processing criteria
Identify qualifying rows
Read qualifying rows
Process rows and modify values
Commit transaction
Warehouse Database
Transaction
T2
Order more copies of 120
Order more copies of 200
Commit transaction
TextBookInventory
100 Chemistry
120 Physics
131 Physical Science
200 Social Studies
310 Inro. To Literature
Customer
1001 Northgate
1040 Westview
1910 Eastland
Nonrepeatable read example.
Search WWH ::




Custom Search