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 9setup 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 17teardown 18{ 19 DROP TABLE t; 20} 21 22session s1 23setup { BEGIN ISOLATION LEVEL SERIALIZABLE; } 24step rx1 { SELECT * FROM t WHERE id = 1000000; } 25# delay until after T3 commits 26step wz1 { UPDATE t SET txt = 'a' WHERE id = 1; } 27step c1 { COMMIT; } 28 29session s2 30setup { BEGIN ISOLATION LEVEL SERIALIZABLE; } 31step wx2 { UPDATE t SET txt = 'b' WHERE id = 1000000; } 32step c2 { COMMIT; } 33 34session s3 35setup { BEGIN ISOLATION LEVEL SERIALIZABLE; } 36step wx3 { UPDATE t SET txt = 'c' WHERE id = 1000000; } 37step ry3 { SELECT * FROM t WHERE id = 500000; } 38# delay until after T4 commits 39step c3 { COMMIT; } 40 41session s4 42setup { BEGIN ISOLATION LEVEL SERIALIZABLE; } 43step wy4 { UPDATE t SET txt = 'd' WHERE id = 500000; } 44step rz4 { SELECT * FROM t WHERE id = 1; } 45step c4 { COMMIT; } 46 47permutation rx1 wx2 c2 wx3 ry3 wy4 rz4 c4 c3 wz1 c1 48