diff options
Diffstat (limited to 'src/test/isolation/specs/cluster-conflict-partition.spec')
-rw-r--r-- | src/test/isolation/specs/cluster-conflict-partition.spec | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/test/isolation/specs/cluster-conflict-partition.spec b/src/test/isolation/specs/cluster-conflict-partition.spec new file mode 100644 index 0000000..5091f68 --- /dev/null +++ b/src/test/isolation/specs/cluster-conflict-partition.spec @@ -0,0 +1,37 @@ +# 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 on the parent 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 + +# When taking a lock on a partition leaf, CLUSTER on the parent skips +# the leaf, passes for all cases. +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 |