| 1 |
# If transaction A holds a lock, and transaction B does an update, |
| 2 |
# make sure we don't forget the lock if B aborts. |
| 3 |
setup |
| 4 |
{ |
| 5 |
CREATE TABLE dont_forget ( |
| 6 |
value int |
| 7 |
); |
| 8 |
|
| 9 |
INSERT INTO dont_forget VALUES (1); |
| 10 |
} |
| 11 |
|
| 12 |
teardown |
| 13 |
{ |
| 14 |
DROP TABLE dont_forget; |
| 15 |
} |
| 16 |
|
| 17 |
session s1 |
| 18 |
setup { BEGIN; } |
| 19 |
step s1_show { SELECT current_setting('default_transaction_isolation') <> 'read committed'; } |
| 20 |
step s1_lock { SELECT * FROM dont_forget FOR KEY SHARE; } |
| 21 |
step s1_commit { COMMIT; } |
| 22 |
|
| 23 |
session s2 |
| 24 |
setup { BEGIN; } |
| 25 |
step s2_update { UPDATE dont_forget SET value = 2; } |
| 26 |
step s2_abort { ROLLBACK; } |
| 27 |
step s2_commit { COMMIT; } |
| 28 |
|
| 29 |
session s3 |
| 30 |
# try cases with both a non-conflicting lock with s1's and a conflicting one |
| 31 |
step s3_forkeyshr { SELECT * FROM dont_forget FOR KEY SHARE; } |
| 32 |
step s3_fornokeyupd { SELECT * FROM dont_forget FOR NO KEY UPDATE; } |
| 33 |
step s3_forupd { SELECT * FROM dont_forget FOR UPDATE; } |
| 34 |
|
| 35 |
permutation s1_show s1_commit s2_commit |
| 36 |
permutation s1_lock s2_update s2_abort s3_forkeyshr s1_commit |
| 37 |
permutation s1_lock s2_update s2_commit s3_forkeyshr s1_commit |
| 38 |
permutation s1_lock s2_update s1_commit s3_forkeyshr s2_commit |
| 39 |
permutation s1_lock s2_update s2_abort s3_fornokeyupd s1_commit |
| 40 |
permutation s1_lock s2_update s2_commit s3_fornokeyupd s1_commit |
| 41 |
permutation s1_lock s2_update s1_commit s3_fornokeyupd s2_commit |
| 42 |
permutation s1_lock s2_update s2_abort s3_forupd s1_commit |
| 43 |
permutation s1_lock s2_update s2_commit s3_forupd s1_commit |
| 44 |
permutation s1_lock s2_update s1_commit s3_forupd s2_commit |