aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2018-01-03 11:16:38 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2018-01-03 12:07:58 -0300
commit87c44b1aa36e78e67f7529fe523e3aa0fb821730 (patch)
tree7868dbdf5ed2fe00ac05176fc58db2dd00f2c4b5 /src
parent724bceae4fde75faacdb900d0f165eac3b6fce4f (diff)
downloadpostgresql-87c44b1aa36e78e67f7529fe523e3aa0fb821730.tar.gz
postgresql-87c44b1aa36e78e67f7529fe523e3aa0fb821730.zip
Fix isolation test to be less timing-dependent
I did this by adding another locking process, which makes the other two wait. This way the output should be stable enough. Per buildfarm and Andres Freund Discussion: https://postgr.es/m/20180103034445.t3utrtrnrevfsghm@alap3.anarazel.de
Diffstat (limited to 'src')
-rw-r--r--src/test/isolation/expected/multiple-cic.out17
-rw-r--r--src/test/isolation/specs/multiple-cic.spec12
2 files changed, 19 insertions, 10 deletions
diff --git a/src/test/isolation/expected/multiple-cic.out b/src/test/isolation/expected/multiple-cic.out
index cc579403925..0b470e7d1de 100644
--- a/src/test/isolation/expected/multiple-cic.out
+++ b/src/test/isolation/expected/multiple-cic.out
@@ -1,6 +1,9 @@
-Parsed test spec with 2 sessions
+Parsed test spec with 3 sessions
-starting permutation: s2l s1i s2i
+starting permutation: s2l s1i s2i s3u
+pg_advisory_lock
+
+
step s2l: SELECT pg_advisory_lock(281457);
pg_advisory_lock
@@ -11,9 +14,11 @@ step s1i:
<waiting ...>
step s2i:
CREATE INDEX CONCURRENTLY mcic_two_pkey ON mcic_two (id)
- WHERE unlck();
+ WHERE unlck() AND lck_shr(572814);
+ <waiting ...>
+step s3u: SELECT unlck();
+unlck
+t
step s1i: <... completed>
-s1
-
-
+step s2i: <... completed>
diff --git a/src/test/isolation/specs/multiple-cic.spec b/src/test/isolation/specs/multiple-cic.spec
index a7ba4eb4fd1..fbec67ee252 100644
--- a/src/test/isolation/specs/multiple-cic.spec
+++ b/src/test/isolation/specs/multiple-cic.spec
@@ -26,15 +26,19 @@ session "s1"
step "s1i" {
CREATE INDEX CONCURRENTLY mcic_one_pkey ON mcic_one (id)
WHERE lck_shr(281457);
- }
-teardown { SELECT pg_advisory_unlock_all() AS "s1"; }
+}
+step "s1u" { 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();
+ WHERE unlck() AND lck_shr(572814);
}
-permutation "s2l" "s1i" "s2i"
+session "s3"
+setup { SELECT pg_advisory_lock(572814); }
+step "s3u" { SELECT unlck(); }
+
+permutation "s2l" "s1i" "s2i" "s3u"