Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 997563d

Browse files
committed
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 43e0841). Which does indeed seem quite possible. Avoid the problem by only looking for the backends participating in the test.
1 parent dcdbb5a commit 997563d

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

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

+12-3
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,10 @@ s1: NOTICE: acquiring advisory lock on 2
361361
step controller_print_speculative_locks:
362362
SELECT pa.application_name, locktype, mode, granted
363363
FROM pg_locks pl JOIN pg_stat_activity pa USING (pid)
364-
WHERE locktype IN ('speculative token', 'transactionid') AND pa.datname = current_database()
364+
WHERE
365+
locktype IN ('speculative token', 'transactionid')
366+
AND pa.datname = current_database()
367+
AND pa.application_name LIKE 'isolation/insert-conflict-specconflict-s%'
365368
ORDER BY 1, 2, 3, 4;
366369

367370
application_namelocktype mode granted
@@ -380,7 +383,10 @@ step s2_upsert: <... completed>
380383
step controller_print_speculative_locks:
381384
SELECT pa.application_name, locktype, mode, granted
382385
FROM pg_locks pl JOIN pg_stat_activity pa USING (pid)
383-
WHERE locktype IN ('speculative token', 'transactionid') AND pa.datname = current_database()
386+
WHERE
387+
locktype IN ('speculative token', 'transactionid')
388+
AND pa.datname = current_database()
389+
AND pa.application_name LIKE 'isolation/insert-conflict-specconflict-s%'
384390
ORDER BY 1, 2, 3, 4;
385391

386392
application_namelocktype mode granted
@@ -399,7 +405,10 @@ k1 inserted s2 with conflict update s1
399405
step controller_print_speculative_locks:
400406
SELECT pa.application_name, locktype, mode, granted
401407
FROM pg_locks pl JOIN pg_stat_activity pa USING (pid)
402-
WHERE locktype IN ('speculative token', 'transactionid') AND pa.datname = current_database()
408+
WHERE
409+
locktype IN ('speculative token', 'transactionid')
410+
AND pa.datname = current_database()
411+
AND pa.application_name LIKE 'isolation/insert-conflict-specconflict-s%'
403412
ORDER BY 1, 2, 3, 4;
404413

405414
application_namelocktype mode granted

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ step "controller_show_count" {SELECT COUNT(*) FROM upserttest; }
6363
step "controller_print_speculative_locks" {
6464
SELECT pa.application_name, locktype, mode, granted
6565
FROM pg_locks pl JOIN pg_stat_activity pa USING (pid)
66-
WHERE locktype IN ('speculative token', 'transactionid') AND pa.datname = current_database()
66+
WHERE
67+
locktype IN ('speculative token', 'transactionid')
68+
AND pa.datname = current_database()
69+
AND pa.application_name LIKE 'isolation/insert-conflict-specconflict-s%'
6770
ORDER BY 1, 2, 3, 4;
6871
}
6972

0 commit comments

Comments
 (0)