mirror of
https://github.com/postgres/postgres.git
synced 2026-04-21 14:19:26 -04:00
This reverts commit 2268e6afd5. It turned out that inconsistency in
the report is still possible, so go back to the simpler formulation of
the test and instead add an alternate expected output.
Discussion: https://postgr.es/m/20180103193728.ysqpcp2xjnqpiep7@alvherre.pgsql
40 lines
881 B
Ruby
40 lines
881 B
Ruby
# Test multiple CREATE INDEX CONCURRENTLY working simultaneously
|
|
|
|
setup
|
|
{
|
|
CREATE TABLE mcic_one (
|
|
id int
|
|
);
|
|
CREATE TABLE mcic_two (
|
|
id int
|
|
);
|
|
CREATE FUNCTION lck_shr(bigint) RETURNS bool IMMUTABLE LANGUAGE plpgsql AS $$
|
|
BEGIN PERFORM pg_advisory_lock_shared($1); RETURN true; END;
|
|
$$;
|
|
CREATE FUNCTION unlck() RETURNS bool IMMUTABLE LANGUAGE plpgsql AS $$
|
|
BEGIN PERFORM pg_advisory_unlock_all(); RETURN true; END;
|
|
$$;
|
|
}
|
|
teardown
|
|
{
|
|
DROP TABLE mcic_one, mcic_two;
|
|
DROP FUNCTION lck_shr(bigint);
|
|
DROP FUNCTION unlck();
|
|
}
|
|
|
|
session "s1"
|
|
step "s1i" {
|
|
CREATE INDEX CONCURRENTLY mcic_one_pkey ON mcic_one (id)
|
|
WHERE lck_shr(281457);
|
|
}
|
|
teardown { SELECT unlck(); }
|
|
|
|
|
|
session "s2"
|
|
step "s2l" { SELECT pg_advisory_lock(281457); }
|
|
step "s2i" {
|
|
CREATE INDEX CONCURRENTLY mcic_two_pkey ON mcic_two (id)
|
|
WHERE unlck();
|
|
}
|
|
|
|
permutation "s2l" "s1i" "s2i"
|