postgrespro.git / summary / log / commit / refs
commit 997563dfcb2501a7a199589cd6f15f2bb8af3d04
Author: Andres Freund <andres@anarazel.de>
Date: Wed Feb 12 05:14:08 2020 +0000
Try to harden insert-conflict-specconflict against autovacuum.
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.
.../isolation/expected/insert-conflict-specconflict.out | 15 ++++++++++++---
.../isolation/specs/insert-conflict-specconflict.spec | 5 ++++-
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/test/isolation/expected/insert-conflict-specconflict.out b/src/test/isolation/expected/insert-conflict-specconflict.out
index f30bf9c94d..9be5ccf55f 100644
--- a/src/test/isolation/expected/insert-conflict-specconflict.out
+++ b/src/test/isolation/expected/insert-conflict-specconflict.out
@@ -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
diff --git a/src/test/isolation/specs/insert-conflict-specconflict.spec b/src/test/isolation/specs/insert-conflict-specconflict.spec
index 6b8810919d..2572072c9e 100644
--- a/src/test/isolation/specs/insert-conflict-specconflict.spec
+++ b/src/test/isolation/specs/insert-conflict-specconflict.spec
@@ -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;
}
[parent: dcdbb5a5db09]