Improve stability of tests for VACUUM (SKIP_LOCKED)
authorMichael Paquier <[email protected]>
Sat, 16 Nov 2019 06:23:12 +0000 (15:23 +0900)
committerMichael Paquier <[email protected]>
Sat, 16 Nov 2019 06:23:12 +0000 (15:23 +0900)
Concurrent autovacuums running with the main regression test suite
could cause the tests with VACUUM (SKIP_LOCKED) to generate randomly
WARNING messages.  For these tests, set client_min_messages to ERROR to
get rid of those random failures, as disabling autovacuum for the
relations operated would not completely close the failure window.

For isolation tests, disable autovacuum for the relations vacuumed with
SKIP_LOCKED.  The tests are designed so as LOCK commands are taken
in a first session before running a concurrent VACUUM (SKIP_LOCKED) in a
second to generate WARNING messages, but a concurrent autovacuum could
cause the tests to be slower.

Reported-by: Tom Lane
Author: Michael Paquier
Reviewed-by: Andres Freund, Tom Lane
Discussion: https://postgr.es/m/25294.1573077278@sss.pgh.pa.us
Back-through: 12

src/test/isolation/specs/vacuum-skip-locked.spec
src/test/regress/expected/vacuum.out
src/test/regress/sql/vacuum.sql

index 4d59b294ca96c29f3627c3e9e52a74953496c032..4f749e74b6aad4eff097a9b279132528e5b9e5f4 100644 (file)
@@ -7,7 +7,9 @@ setup
 {
        CREATE TABLE parted (a INT) PARTITION BY LIST (a);
        CREATE TABLE part1 PARTITION OF parted FOR VALUES IN (1);
+       ALTER TABLE part1 SET (autovacuum_enabled = false);
        CREATE TABLE part2 PARTITION OF parted FOR VALUES IN (2);
+       ALTER TABLE part2 SET (autovacuum_enabled = false);
 }
 
 teardown
index aff0b10a93900deedafaa91a1f25acd61fd0f19f..9996d882d161d076b2b4c48fbbc20ed8ac5f3e1f 100644 (file)
@@ -196,7 +196,9 @@ ERROR:  unrecognized ANALYZE option "nonexistentarg"
 LINE 1: ANALYZE (nonexistentarg) does_not_exit;
                  ^
 -- ensure argument order independence, and that SKIP_LOCKED on non-existing
--- relation still errors out.
+-- relation still errors out.  Suppress WARNING messages caused by concurrent
+-- autovacuums.
+SET client_min_messages TO 'ERROR';
 ANALYZE (SKIP_LOCKED, VERBOSE) does_not_exist;
 ERROR:  relation "does_not_exist" does not exist
 ANALYZE (VERBOSE, SKIP_LOCKED) does_not_exist;
@@ -205,6 +207,7 @@ ERROR:  relation "does_not_exist" does not exist
 VACUUM (SKIP_LOCKED) vactst;
 VACUUM (SKIP_LOCKED, FULL) vactst;
 ANALYZE (SKIP_LOCKED) vactst;
+RESET client_min_messages;
 -- ensure VACUUM and ANALYZE don't have a problem with serializable
 SET default_transaction_isolation = serializable;
 VACUUM vactst;
index f0fee3af2bff13f5229379d9fc15c044adcd2303..69987f75e9bc1d02f05e7fde9b210f867d06078e 100644 (file)
@@ -158,7 +158,9 @@ ANALYZE (nonexistent-arg) does_not_exist;
 ANALYZE (nonexistentarg) does_not_exit;
 
 -- ensure argument order independence, and that SKIP_LOCKED on non-existing
--- relation still errors out.
+-- relation still errors out.  Suppress WARNING messages caused by concurrent
+-- autovacuums.
+SET client_min_messages TO 'ERROR';
 ANALYZE (SKIP_LOCKED, VERBOSE) does_not_exist;
 ANALYZE (VERBOSE, SKIP_LOCKED) does_not_exist;
 
@@ -166,6 +168,7 @@ ANALYZE (VERBOSE, SKIP_LOCKED) does_not_exist;
 VACUUM (SKIP_LOCKED) vactst;
 VACUUM (SKIP_LOCKED, FULL) vactst;
 ANALYZE (SKIP_LOCKED) vactst;
+RESET client_min_messages;
 
 -- ensure VACUUM and ANALYZE don't have a problem with serializable
 SET default_transaction_isolation = serializable;