 |
» |
|
|
 |
 |
 |

5.9 How does ALLBASE/SQL resolve deadlocks?
Key points
- A deadlock occurs when at least two transactions are waiting for
each other to complete. Each has already obtained a lock on data that the
other needs to complete its work. Each would wait forever to obtain the
other's lock if ALLBASE/SQL did not detect the deadlock situation and issue a
ROLLBACK WORK for one of the transactions. Deadlocks are not always this
simple. Sometimes a ring of transactions enter into a deadlock.
- The priority of a transaction is an integer value from 0 to 255 that can
be specified during the
BEGIN WORK statement. A priority of 127 is
assigned by default if no value is explicitly specified.
- If only two transactions are involved in the deadlock, the transaction having
the largest priority number is rolled back to resolve the deadlock. If both
transactions have the same priority, then the most recent transaction is
rolled back.
- If more than two transactions are involved in the deadlock, ALLBASE/SQL
resolves the deadlock by choosing a victim from only two of the transactions:
the last transaction to enter the ring (the one that caused
the deadlock loop to be closed), and the transaction that is waiting for it.
The victim is selected using the rules described above on these two
transactions. Notice that the transaction that is aborted may not be the
transaction with the largest priority number or the most recent transaction
among all transactions that are involved in the deadlock.

Page last updated on November 29, 1995
|
|
|