Try to harden insert-conflict-specconflict against autovacuum.
authorAndres Freund <andres@anarazel.de>
Wed, 12 Feb 2020 05:14:08 +0000 (21:14 -0800)
committerAndres Freund <andres@anarazel.de>
Wed, 12 Feb 2020 05:18:14 +0000 (21:18 -0800)
Looks like guaibasaurus had a autovacuum running during the
controller_print_speculative_locks step (just added in
43e08419708). Which does indeed seem quite possible.

Avoid the problem by only looking for the backends participating in
the test.

src/test/isolation/expected/insert-conflict-specconflict.out
src/test/isolation/specs/insert-conflict-specconflict.spec

index f30bf9c94da74e9e2f0bd825de922ac35c94c249..9be5ccf55f05e7a4d8df292c8ed354d37ab43332 100644 (file)
@@ -361,7 +361,10 @@ s1: NOTICE:  acquiring advisory lock on 2
 step controller_print_speculative_locks: 
     SELECT pa.application_name, locktype, mode, granted
     FROM pg_locks pl JOIN pg_stat_activity pa USING (pid)
-    WHERE locktype IN ('speculative token', 'transactionid') AND pa.datname = current_database()
+    WHERE
+        locktype IN ('speculative token', 'transactionid')
+        AND pa.datname = current_database()
+        AND pa.application_name LIKE 'isolation/insert-conflict-specconflict-s%'
     ORDER BY 1, 2, 3, 4;
 
 application_namelocktype       mode           granted        
@@ -380,7 +383,10 @@ step s2_upsert: <... completed>
 step controller_print_speculative_locks: 
     SELECT pa.application_name, locktype, mode, granted
     FROM pg_locks pl JOIN pg_stat_activity pa USING (pid)
-    WHERE locktype IN ('speculative token', 'transactionid') AND pa.datname = current_database()
+    WHERE
+        locktype IN ('speculative token', 'transactionid')
+        AND pa.datname = current_database()
+        AND pa.application_name LIKE 'isolation/insert-conflict-specconflict-s%'
     ORDER BY 1, 2, 3, 4;
 
 application_namelocktype       mode           granted        
@@ -399,7 +405,10 @@ k1             inserted s2 with conflict update s1
 step controller_print_speculative_locks: 
     SELECT pa.application_name, locktype, mode, granted
     FROM pg_locks pl JOIN pg_stat_activity pa USING (pid)
-    WHERE locktype IN ('speculative token', 'transactionid') AND pa.datname = current_database()
+    WHERE
+        locktype IN ('speculative token', 'transactionid')
+        AND pa.datname = current_database()
+        AND pa.application_name LIKE 'isolation/insert-conflict-specconflict-s%'
     ORDER BY 1, 2, 3, 4;
 
 application_namelocktype       mode           granted        
index 6b8810919d9ec328b79c3147e62f7b32f821f55f..2572072c9e6b31f49d65114ac19eea2a5a72302b 100644 (file)
@@ -63,7 +63,10 @@ step "controller_show_count" {SELECT COUNT(*) FROM upserttest; }
 step "controller_print_speculative_locks" {
     SELECT pa.application_name, locktype, mode, granted
     FROM pg_locks pl JOIN pg_stat_activity pa USING (pid)
-    WHERE locktype IN ('speculative token', 'transactionid') AND pa.datname = current_database()
+    WHERE
+        locktype IN ('speculative token', 'transactionid')
+        AND pa.datname = current_database()
+        AND pa.application_name LIKE 'isolation/insert-conflict-specconflict-s%'
     ORDER BY 1, 2, 3, 4;
 }