summaryrefslogtreecommitdiff
path: root/src/test/isolation/specs/cluster-conflict-partition.spec
blob: ae38cb4ee3d6dc307d4e8b3cc1fdd57831939559 (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
# Tests for locking conflicts with CLUSTER command and partitions.

setup
{
	CREATE ROLE regress_cluster_part;
	CREATE TABLE cluster_part_tab (a int) PARTITION BY LIST (a);
	CREATE TABLE cluster_part_tab1 PARTITION OF cluster_part_tab FOR VALUES IN (1);
	CREATE TABLE cluster_part_tab2 PARTITION OF cluster_part_tab FOR VALUES IN (2);
	CREATE INDEX cluster_part_ind ON cluster_part_tab(a);
	ALTER TABLE cluster_part_tab OWNER TO regress_cluster_part;
}

teardown
{
	DROP TABLE cluster_part_tab;
	DROP ROLE regress_cluster_part;
}

session s1
step s1_begin          { BEGIN; }
step s1_lock_parent    { LOCK cluster_part_tab IN SHARE UPDATE EXCLUSIVE MODE; }
step s1_lock_child     { LOCK cluster_part_tab1 IN SHARE UPDATE EXCLUSIVE MODE; }
step s1_commit         { COMMIT; }

session s2
step s2_auth           { SET ROLE regress_cluster_part; }
step s2_cluster        { CLUSTER cluster_part_tab USING cluster_part_ind; }
step s2_reset          { RESET ROLE; }

# CLUSTER waits if locked, passes for all cases.
permutation s1_begin s1_lock_parent s2_auth s2_cluster s1_commit s2_reset
permutation s1_begin s2_auth s1_lock_parent s2_cluster s1_commit s2_reset
permutation s1_begin s1_lock_child s2_auth s2_cluster s1_commit s2_reset
permutation s1_begin s2_auth s1_lock_child s2_cluster s1_commit s2_reset