]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Disable vacuum page skipping in selected test cases.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 20 Jan 2021 16:49:29 +0000 (11:49 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 20 Jan 2021 16:49:29 +0000 (11:49 -0500)
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

contrib/pageinspect/expected/page.out
contrib/pageinspect/sql/page.sql
contrib/pg_visibility/expected/pg_visibility.out
contrib/pg_visibility/sql/pg_visibility.sql

index 5edb650085906b0007905f4cebcee98d9fac21bd..8e0300a41d1f55e2e1a3e4f57d475597a7e1ffb3 100644 (file)
@@ -1,7 +1,7 @@
 CREATE EXTENSION pageinspect;
 CREATE TABLE test1 (a int, b int);
 INSERT INTO test1 VALUES (16777217, 131584);
-VACUUM test1;  -- set up FSM
+VACUUM (DISABLE_PAGE_SKIPPING) test1;  -- set up FSM
 -- The page contents can vary, so just test that it can be read
 -- successfully, but don't keep the output.
 SELECT octet_length(get_raw_page('test1', 'main', 0)) AS main_0;
index 8f35830e067a6afc038ebbf22b63289157c7234a..eb50e65a867b03ca908abb63dd22c5845951f25b 100644 (file)
@@ -3,7 +3,7 @@ CREATE EXTENSION pageinspect;
 CREATE TABLE test1 (a int, b int);
 INSERT INTO test1 VALUES (16777217, 131584);
 
-VACUUM test1;  -- set up FSM
+VACUUM (DISABLE_PAGE_SKIPPING) test1;  -- set up FSM
 
 -- The page contents can vary, so just test that it can be read
 -- successfully, but don't keep the output.
index f0dcb897c4bfa1b591d32daf8c5d02c3208eb5df..cc1edeba738ec4d0ca1de4e0899de1a734e35f3c 100644 (file)
@@ -69,7 +69,7 @@ ERROR:  "test_foreign_table" is not a table, materialized view, or TOAST table
 -- check some of the allowed relkinds
 create table regular_table (a int);
 insert into regular_table values (1), (2);
-vacuum regular_table;
+vacuum (disable_page_skipping) regular_table;
 select count(*) > 0 from pg_visibility('regular_table');
  ?column? 
 ----------
@@ -84,7 +84,7 @@ select count(*) > 0 from pg_visibility('regular_table');
 (1 row)
 
 create materialized view matview_visibility_test as select * from regular_table;
-vacuum matview_visibility_test;
+vacuum (disable_page_skipping) matview_visibility_test;
 select count(*) > 0 from pg_visibility('matview_visibility_test');
  ?column? 
 ----------
@@ -101,7 +101,7 @@ select count(*) > 0 from pg_visibility('matview_visibility_test');
 
 -- regular tables which are part of a partition *do* have visibility maps
 insert into test_partition values (1);
-vacuum test_partition;
+vacuum (disable_page_skipping) test_partition;
 select count(*) > 0 from pg_visibility('test_partition', 0);
  ?column? 
 ----------
index c2a7f1d9e421506c686cdcb420059f10ef7969ba..6f4c9a42f9d38ab234da2f51befd6409aafc3934 100644 (file)
@@ -51,13 +51,13 @@ select pg_truncate_visibility_map('test_foreign_table');
 -- check some of the allowed relkinds
 create table regular_table (a int);
 insert into regular_table values (1), (2);
-vacuum regular_table;
+vacuum (disable_page_skipping) regular_table;
 select count(*) > 0 from pg_visibility('regular_table');
 truncate regular_table;
 select count(*) > 0 from pg_visibility('regular_table');
 
 create materialized view matview_visibility_test as select * from regular_table;
-vacuum matview_visibility_test;
+vacuum (disable_page_skipping) matview_visibility_test;
 select count(*) > 0 from pg_visibility('matview_visibility_test');
 insert into regular_table values (1), (2);
 refresh materialized view matview_visibility_test;
@@ -65,7 +65,7 @@ select count(*) > 0 from pg_visibility('matview_visibility_test');
 
 -- regular tables which are part of a partition *do* have visibility maps
 insert into test_partition values (1);
-vacuum test_partition;
+vacuum (disable_page_skipping) test_partition;
 select count(*) > 0 from pg_visibility('test_partition', 0);
 select count(*) > 0 from pg_visibility_map('test_partition');
 select count(*) > 0 from pg_visibility_map_summary('test_partition');