summaryrefslogtreecommitdiffstats
path: root/src/test/isolation/specs/two-ids.spec
blob: fc0289f236d7d2a48e624395a73e76e20193bee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Two IDs test
#
# Small, simple test showing read-only anomalies.
#
# There are only four permutations which must cause a serialization failure.
# Required failure cases are where s2 overlaps both s1 and s3, but s1
# commits before s3 executes its first SELECT.
#
# If s3 were declared READ ONLY there would be no false positives.
# With s3 defaulting to READ WRITE, we currently expect 12 false
# positives.  Further work dealing with de facto READ ONLY transactions
# may be able to reduce or eliminate those false positives.

setup
{
 create table D1 (id int not null);
 create table D2 (id int not null);
 insert into D1 values (1);
 insert into D2 values (1);
}

teardown
{
 DROP TABLE D1, D2;
}

session s1
setup		{ BEGIN ISOLATION LEVEL SERIALIZABLE; }
step wx1	{ update D1 set id = id + 1; }
step c1		{ COMMIT; }

session s2
setup		{ BEGIN ISOLATION LEVEL SERIALIZABLE; }
step rxwy2	{ update D2 set id = (select id+1 from D1); }
step c2		{ COMMIT; }

session s3
setup		{ BEGIN ISOLATION LEVEL SERIALIZABLE; }
step ry3	{ select id from D2; }
step c3		{ COMMIT; }