Debian Codegraph @

src/test/isolation/specs/multiple-row-versions.spec

raw
1 # Multiple Row Versions test
2 #
3 # This test is designed to cover some code paths which only occur with
4 # four or more transactions interacting with particular timings.
5 #
6 # Due to long permutation setup time, we are only testing one specific
7 # permutation, which should get a serialization error.
8
9 setup
10 {
11 CREATE TABLE t (id int NOT NULL, txt text) WITH (fillfactor=50);
12 INSERT INTO t (id)
13 SELECT x FROM (SELECT * FROM generate_series(1, 1000000)) a(x);
14 ALTER TABLE t ADD PRIMARY KEY (id);
15 }
16
17 teardown
18 {
19 DROP TABLE t;
20 }
21
22 session s1
23 setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
24 step rx1 { SELECT * FROM t WHERE id = 1000000; }
25 # delay until after T3 commits
26 step wz1 { UPDATE t SET txt = 'a' WHERE id = 1; }
27 step c1 { COMMIT; }
28
29 session s2
30 setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
31 step wx2 { UPDATE t SET txt = 'b' WHERE id = 1000000; }
32 step c2 { COMMIT; }
33
34 session s3
35 setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
36 step wx3 { UPDATE t SET txt = 'c' WHERE id = 1000000; }
37 step ry3 { SELECT * FROM t WHERE id = 500000; }
38 # delay until after T4 commits
39 step c3 { COMMIT; }
40
41 session s4
42 setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
43 step wy4 { UPDATE t SET txt = 'd' WHERE id = 500000; }
44 step rz4 { SELECT * FROM t WHERE id = 1; }
45 step c4 { COMMIT; }
46
47 permutation rx1 wx2 c2 wx3 ry3 wy4 rz4 c4 c3 wz1 c1