Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3db0598

Browse filesBrowse files
committed
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
1 parent 2dc08bd commit 3db0598
Copy full SHA for 3db0598

File tree

Expand file treeCollapse file tree

3 files changed

+10
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+10
-2
lines changed

‎src/test/isolation/specs/vacuum-skip-locked.spec

Copy file name to clipboardExpand all lines: src/test/isolation/specs/vacuum-skip-locked.spec
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ setup
77
{
88
CREATE TABLE parted (a INT) PARTITION BY LIST (a);
99
CREATE TABLE part1 PARTITION OF parted FOR VALUES IN (1);
10+
ALTER TABLE part1 SET (autovacuum_enabled = false);
1011
CREATE TABLE part2 PARTITION OF parted FOR VALUES IN (2);
12+
ALTER TABLE part2 SET (autovacuum_enabled = false);
1113
}
1214

1315
teardown

‎src/test/regress/expected/vacuum.out

Copy file name to clipboardExpand all lines: src/test/regress/expected/vacuum.out
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ ERROR: unrecognized ANALYZE option "nonexistentarg"
196196
LINE 1: ANALYZE (nonexistentarg) does_not_exit;
197197
^
198198
-- ensure argument order independence, and that SKIP_LOCKED on non-existing
199-
-- relation still errors out.
199+
-- relation still errors out. Suppress WARNING messages caused by concurrent
200+
-- autovacuums.
201+
SET client_min_messages TO 'ERROR';
200202
ANALYZE (SKIP_LOCKED, VERBOSE) does_not_exist;
201203
ERROR: relation "does_not_exist" does not exist
202204
ANALYZE (VERBOSE, SKIP_LOCKED) does_not_exist;
@@ -205,6 +207,7 @@ ERROR: relation "does_not_exist" does not exist
205207
VACUUM (SKIP_LOCKED) vactst;
206208
VACUUM (SKIP_LOCKED, FULL) vactst;
207209
ANALYZE (SKIP_LOCKED) vactst;
210+
RESET client_min_messages;
208211
-- ensure VACUUM and ANALYZE don't have a problem with serializable
209212
SET default_transaction_isolation = serializable;
210213
VACUUM vactst;

‎src/test/regress/sql/vacuum.sql

Copy file name to clipboardExpand all lines: src/test/regress/sql/vacuum.sql
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,17 @@ ANALYZE (nonexistent-arg) does_not_exist;
158158
ANALYZE (nonexistentarg) does_not_exit;
159159

160160
-- ensure argument order independence, and that SKIP_LOCKED on non-existing
161-
-- relation still errors out.
161+
-- relation still errors out. Suppress WARNING messages caused by concurrent
162+
-- autovacuums.
163+
SET client_min_messages TO 'ERROR';
162164
ANALYZE (SKIP_LOCKED, VERBOSE) does_not_exist;
163165
ANALYZE (VERBOSE, SKIP_LOCKED) does_not_exist;
164166

165167
-- SKIP_LOCKED option
166168
VACUUM (SKIP_LOCKED) vactst;
167169
VACUUM (SKIP_LOCKED, FULL) vactst;
168170
ANALYZE (SKIP_LOCKED) vactst;
171+
RESET client_min_messages;
169172

170173
-- ensure VACUUM and ANALYZE don't have a problem with serializable
171174
SET default_transaction_isolation = serializable;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.