Debian Codegraph @

src/test/isolation/specs/deadlock-soft-2.spec

raw
1 # Soft deadlock requiring reversal of multiple wait-edges. s1 must
2 # jump over both s3 and s4 and acquire the lock on a2 immediately,
3 # since s3 and s4 are hard-blocked on a1.
4
5 setup
6 {
7 CREATE TABLE a1 ();
8 CREATE TABLE a2 ();
9 }
10
11 teardown
12 {
13 DROP TABLE a1, a2;
14 }
15
16 session s1
17 setup { BEGIN; SET deadlock_timeout = '10ms'; }
18 step s1a { LOCK TABLE a1 IN SHARE UPDATE EXCLUSIVE MODE; }
19 step s1b { LOCK TABLE a2 IN SHARE UPDATE EXCLUSIVE MODE; }
20 step s1c { COMMIT; }
21
22 session s2
23 setup { BEGIN; SET deadlock_timeout = '100s'; }
24 step s2a { LOCK TABLE a2 IN ACCESS SHARE MODE; }
25 step s2b { LOCK TABLE a1 IN SHARE UPDATE EXCLUSIVE MODE; }
26 step s2c { COMMIT; }
27
28 session s3
29 setup { BEGIN; SET deadlock_timeout = '100s'; }
30 step s3a { LOCK TABLE a2 IN ACCESS EXCLUSIVE MODE; }
31 step s3c { COMMIT; }
32
33 session s4
34 setup { BEGIN; SET deadlock_timeout = '100s'; }
35 step s4a { LOCK TABLE a2 IN ACCESS EXCLUSIVE MODE; }
36 step s4c { COMMIT; }
37
38 # The expected output for this test assumes that isolationtester will
39 # detect step s1b as waiting before the deadlock detector runs and
40 # releases s1 from its blocked state. To ensure that happens even in
41 # very slow (debug_discard_caches) cases, apply a (*) annotation.
42
43 permutation s1a s2a s2b s3a s4a s1b(*) s1c s2c s3c s4c