Debian Codegraph @

src/test/isolation/specs/two-ids.spec

raw
1 # Two IDs test
2 #
3 # Small, simple test showing read-only anomalies.
4 #
5 # There are only four permutations which must cause a serialization failure.
6 # Required failure cases are where s2 overlaps both s1 and s3, but s1
7 # commits before s3 executes its first SELECT.
8 #
9 # If s3 were declared READ ONLY there would be no false positives.
10 # With s3 defaulting to READ WRITE, we currently expect 12 false
11 # positives. Further work dealing with de facto READ ONLY transactions
12 # may be able to reduce or eliminate those false positives.
13
14 setup
15 {
16 create table D1 (id int not null);
17 create table D2 (id int not null);
18 insert into D1 values (1);
19 insert into D2 values (1);
20 }
21
22 teardown
23 {
24 DROP TABLE D1, D2;
25 }
26
27 session s1
28 setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
29 step wx1 { update D1 set id = id + 1; }
30 step c1 { COMMIT; }
31
32 session s2
33 setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
34 step rxwy2 { update D2 set id = (select id+1 from D1); }
35 step c2 { COMMIT; }
36
37 session s3
38 setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
39 step ry3 { select id from D2; }
40 step c3 { COMMIT; }