Debian Codegraph @

src/test/isolation/specs/cluster-conflict-partition.spec

raw
1 # Tests for locking conflicts with CLUSTER command and partitions.
2
3 setup
4 {
5 CREATE ROLE regress_cluster_part;
6 CREATE TABLE cluster_part_tab (a int) PARTITION BY LIST (a);
7 CREATE TABLE cluster_part_tab1 PARTITION OF cluster_part_tab FOR VALUES IN (1);
8 CREATE TABLE cluster_part_tab2 PARTITION OF cluster_part_tab FOR VALUES IN (2);
9 CREATE INDEX cluster_part_ind ON cluster_part_tab(a);
10 ALTER TABLE cluster_part_tab OWNER TO regress_cluster_part;
11 }
12
13 teardown
14 {
15 DROP TABLE cluster_part_tab;
16 DROP ROLE regress_cluster_part;
17 }
18
19 session s1
20 step s1_begin { BEGIN; }
21 step s1_lock_parent { LOCK cluster_part_tab IN SHARE UPDATE EXCLUSIVE MODE; }
22 step s1_lock_child { LOCK cluster_part_tab1 IN SHARE UPDATE EXCLUSIVE MODE; }
23 step s1_commit { COMMIT; }
24
25 session s2
26 step s2_auth { SET ROLE regress_cluster_part; SET client_min_messages = ERROR; }
27 step s2_cluster { CLUSTER cluster_part_tab USING cluster_part_ind; }
28 step s2_reset { RESET ROLE; }
29
30 # CLUSTER on the parent waits if locked, passes for all cases.
31 permutation s1_begin s1_lock_parent s2_auth s2_cluster s1_commit s2_reset
32 permutation s1_begin s2_auth s1_lock_parent s2_cluster s1_commit s2_reset
33
34 # When taking a lock on a partition leaf, CLUSTER on the parent skips
35 # the leaf, passes for all cases.
36 permutation s1_begin s1_lock_child s2_auth s2_cluster s1_commit s2_reset
37 permutation s1_begin s2_auth s1_lock_child s2_cluster s1_commit s2_reset