]> granicus.if.org Git - postgresql/commitdiff
Fix isolation test to be less timing-dependent
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 3 Jan 2018 14:16:34 +0000 (11:16 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 3 Jan 2018 15:06:56 +0000 (12:06 -0300)
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

src/test/isolation/expected/multiple-cic.out
src/test/isolation/specs/multiple-cic.spec

index cc579403925ad4d4ca26f18907fa1c464749e407..0b470e7d1def9cf852437c267490282b27468912 100644 (file)
@@ -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>
index a7ba4eb4fd179aa546513290378a9d22623433e8..fbec67ee252550403aa22709e9b09abead0d4e26 100644 (file)
@@ -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"