Debian Codegraph @

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

raw
1 # Tests for locking conflicts with CLUSTER command.
2
3 setup
4 {
5 CREATE ROLE regress_cluster_conflict;
6 CREATE TABLE cluster_tab (a int);
7 CREATE INDEX cluster_ind ON cluster_tab(a);
8 ALTER TABLE cluster_tab OWNER TO regress_cluster_conflict;
9 }
10
11 teardown
12 {
13 DROP TABLE cluster_tab;
14 DROP ROLE regress_cluster_conflict;
15 }
16
17 session s1
18 step s1_begin { BEGIN; }
19 step s1_lock { LOCK cluster_tab IN SHARE UPDATE EXCLUSIVE MODE; }
20 step s1_commit { COMMIT; }
21
22 session s2
23 step s2_auth { SET ROLE regress_cluster_conflict; }
24 step s2_cluster { CLUSTER cluster_tab USING cluster_ind; }
25 step s2_reset { RESET ROLE; }
26
27 # The role has privileges to cluster the table, CLUSTER will block if
28 # another session holds a lock on the table and succeed in all cases.
29 permutation s1_begin s1_lock s2_auth s2_cluster s1_commit s2_reset
30 permutation s1_begin s2_auth s1_lock s2_cluster s1_commit s2_reset