Stabilize test of BRIN parallel create
authorTomas Vondra <[email protected]>
Tue, 16 Apr 2024 15:31:03 +0000 (17:31 +0200)
committerTomas Vondra <[email protected]>
Tue, 16 Apr 2024 15:34:48 +0000 (17:34 +0200)
The test for parallel create of BRIN indexes added by commit 8225c2fd40
happens to be unstable - a background transaction (e.g. auto-analyze)
may hold back global xmin for the initial VACUUM / CREATE INDEX. If the
cleanup happens before the next CREATE INDEX, the indexes will not be
exactly the same.

This is the same issue as e2933a6e11, so fix it the same way by making
the table TEMPORARY, which uses an up-to-date cutoff xmin that is not
held back by other processes.

Reported by Alexander Lakhin, who also suggested the fix.

Author: Alexander Lakhin
Discussion: https://postgr.es/m/b58901cd-a7cc-29c6-e2b1-e3d7317c3c69@gmail.com
Discussion: https://postgr.es/m/2892135.1668976646@sss.pgh.pa.us

contrib/pageinspect/expected/brin.out
contrib/pageinspect/sql/brin.sql

index 67c3549a1241752ef0ec372de32b52bb623836fc..e59451af4b2f7d0d24a259245d86c08521a1af23 100644 (file)
@@ -109,7 +109,7 @@ SELECT (COUNT(*) = (SELECT relpages FROM pg_class WHERE relname = 'test2')) AS r
 DROP TABLE test1;
 DROP TABLE test2;
 -- Test that parallel index build produces the same BRIN index as serial build.
-CREATE TABLE brin_parallel_test (a int, b text, c bigint) WITH (fillfactor=40);
+CREATE TEMPORARY TABLE brin_parallel_test (a int, b text, c bigint) WITH (fillfactor=40);
 -- Generate a table with a mix of NULLs and non-NULL values (and data suitable
 -- for the different opclasses we build later).
 INSERT INTO brin_parallel_test
index a25969d58f06dfa9ef9b304c4fa1d2ee4ce3da74..ac375a427d16042b68897094e0e3b271948f4fb0 100644 (file)
@@ -56,7 +56,7 @@ DROP TABLE test1;
 DROP TABLE test2;
 
 -- Test that parallel index build produces the same BRIN index as serial build.
-CREATE TABLE brin_parallel_test (a int, b text, c bigint) WITH (fillfactor=40);
+CREATE TEMPORARY TABLE brin_parallel_test (a int, b text, c bigint) WITH (fillfactor=40);
 
 -- Generate a table with a mix of NULLs and non-NULL values (and data suitable
 -- for the different opclasses we build later).