| 1 |
# The deadlock detector has a special case for "simple" deadlocks. A simple |
| 2 |
# deadlock occurs when we attempt a lock upgrade while another process waits |
| 3 |
# for a lock upgrade on the same object; and the sought locks conflict with |
| 4 |
# those already held, so that neither process can complete its upgrade until |
| 5 |
# the other releases locks. Test this scenario. |
| 6 |
|
| 7 |
setup |
| 8 |
{ |
| 9 |
CREATE TABLE a1 (); |
| 10 |
} |
| 11 |
|
| 12 |
teardown |
| 13 |
{ |
| 14 |
DROP TABLE a1; |
| 15 |
} |
| 16 |
|
| 17 |
session s1 |
| 18 |
setup { BEGIN; } |
| 19 |
step s1as { LOCK TABLE a1 IN ACCESS SHARE MODE; } |
| 20 |
step s1ae { LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; } |
| 21 |
step s1c { COMMIT; } |
| 22 |
|
| 23 |
session s2 |
| 24 |
setup { BEGIN; } |
| 25 |
step s2as { LOCK TABLE a1 IN ACCESS SHARE MODE; } |
| 26 |
step s2ae { LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; } |
| 27 |
step s2c { COMMIT; } |
| 28 |
|
| 29 |
permutation s1as s2as s1ae s2ae s1c s2c |