diff options
author | Michael Paquier <michael@paquier.xyz> | 2019-11-16 15:23:12 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2019-11-16 15:23:12 +0900 |
commit | 3db0598d908f22435ab8138d1c76b971f17a5633 (patch) | |
tree | 1271ba77e8570c705170a1004293e95c1f60faa5 /src | |
parent | 2dc08bd6179d8cf480c93701010c19ad7a9891d8 (diff) | |
download | postgresql-3db0598d908f22435ab8138d1c76b971f17a5633.tar.gz postgresql-3db0598d908f22435ab8138d1c76b971f17a5633.zip |
Improve stability of tests for VACUUM (SKIP_LOCKED)
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
Backpatch-through: 12
Diffstat (limited to 'src')
-rw-r--r-- | src/test/isolation/specs/vacuum-skip-locked.spec | 2 | ||||
-rw-r--r-- | src/test/regress/expected/vacuum.out | 5 | ||||
-rw-r--r-- | src/test/regress/sql/vacuum.sql | 5 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/test/isolation/specs/vacuum-skip-locked.spec b/src/test/isolation/specs/vacuum-skip-locked.spec index 4d59b294ca9..4f749e74b6a 100644 --- a/src/test/isolation/specs/vacuum-skip-locked.spec +++ b/src/test/isolation/specs/vacuum-skip-locked.spec @@ -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 diff --git a/src/test/regress/expected/vacuum.out b/src/test/regress/expected/vacuum.out index aff0b10a939..9996d882d16 100644 --- a/src/test/regress/expected/vacuum.out +++ b/src/test/regress/expected/vacuum.out @@ -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; diff --git a/src/test/regress/sql/vacuum.sql b/src/test/regress/sql/vacuum.sql index f0fee3af2bf..69987f75e9b 100644 --- a/src/test/regress/sql/vacuum.sql +++ b/src/test/regress/sql/vacuum.sql @@ -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; |