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

Commit 53a24fa

Browse files
committed
Disable vacuum page skipping in selected test cases.
By default VACUUM will skip pages that it can't immediately get exclusive access to, which means that even activities as harmless and unpredictable as checkpoint buffer writes might prevent a page from being processed. Ordinarily this is no big deal, but we have a small number of test cases that examine the results of VACUUM's processing and therefore will fail if the page of interest is skipped. This seems to be the explanation for some rare buildfarm failures. To fix, add the DISABLE_PAGE_SKIPPING option to the VACUUM commands in tests where this could be an issue. In passing, remove a duplicated query in pageinspect/sql/page.sql. Back-patch as necessary (some of these cases are as old as v10). Discussion: https://postgr.es/m/413923.1611006484@sss.pgh.pa.us
1 parent 0326635 commit 53a24fa

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

contrib/pageinspect/expected/page.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CREATE EXTENSION pageinspect;
22
CREATE TABLE test1 (a int, b int);
33
INSERT INTO test1 VALUES (16777217, 131584);
4-
VACUUM test1; -- set up FSM
4+
VACUUM (DISABLE_PAGE_SKIPPING) test1; -- set up FSM
55
-- The page contents can vary, so just test that it can be read
66
-- successfully, but don't keep the output.
77
SELECT octet_length(get_raw_page('test1', 'main', 0)) AS main_0;

contrib/pageinspect/sql/page.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ CREATE EXTENSION pageinspect;
33
CREATE TABLE test1 (a int, b int);
44
INSERT INTO test1 VALUES (16777217, 131584);
55

6-
VACUUM test1; -- set up FSM
6+
VACUUM (DISABLE_PAGE_SKIPPING) test1; -- set up FSM
77

88
-- The page contents can vary, so just test that it can be read
99
-- successfully, but don't keep the output.

contrib/pg_visibility/expected/pg_visibility.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ERROR: "test_foreign_table" is not a table, materialized view, or TOAST table
6969
-- check some of the allowed relkinds
7070
create table regular_table (a int);
7171
insert into regular_table values (1), (2);
72-
vacuum regular_table;
72+
vacuum (disable_page_skipping) regular_table;
7373
select count(*) > 0 from pg_visibility('regular_table');
7474
?column?
7575
----------
@@ -84,7 +84,7 @@ select count(*) > 0 from pg_visibility('regular_table');
8484
(1 row)
8585

8686
create materialized view matview_visibility_test as select * from regular_table;
87-
vacuum matview_visibility_test;
87+
vacuum (disable_page_skipping) matview_visibility_test;
8888
select count(*) > 0 from pg_visibility('matview_visibility_test');
8989
?column?
9090
----------
@@ -101,7 +101,7 @@ select count(*) > 0 from pg_visibility('matview_visibility_test');
101101

102102
-- regular tables which are part of a partition *do* have visibility maps
103103
insert into test_partition values (1);
104-
vacuum test_partition;
104+
vacuum (disable_page_skipping) test_partition;
105105
select count(*) > 0 from pg_visibility('test_partition', 0);
106106
?column?
107107
----------

contrib/pg_visibility/sql/pg_visibility.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,21 @@ select pg_truncate_visibility_map('test_foreign_table');
5151
-- check some of the allowed relkinds
5252
create table regular_table (a int);
5353
insert into regular_table values (1), (2);
54-
vacuum regular_table;
54+
vacuum (disable_page_skipping) regular_table;
5555
select count(*) > 0 from pg_visibility('regular_table');
5656
truncate regular_table;
5757
select count(*) > 0 from pg_visibility('regular_table');
5858

5959
create materialized view matview_visibility_test as select * from regular_table;
60-
vacuum matview_visibility_test;
60+
vacuum (disable_page_skipping) matview_visibility_test;
6161
select count(*) > 0 from pg_visibility('matview_visibility_test');
6262
insert into regular_table values (1), (2);
6363
refresh materialized view matview_visibility_test;
6464
select count(*) > 0 from pg_visibility('matview_visibility_test');
6565

6666
-- regular tables which are part of a partition *do* have visibility maps
6767
insert into test_partition values (1);
68-
vacuum test_partition;
68+
vacuum (disable_page_skipping) test_partition;
6969
select count(*) > 0 from pg_visibility('test_partition', 0);
7070
select count(*) > 0 from pg_visibility_map('test_partition');
7171
select count(*) > 0 from pg_visibility_map_summary('test_partition');

0 commit comments

Comments
 (0)