From b12d7952feb6153cc760cd8c028182927e8b0198 Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Mon, 17 Aug 2020 14:41:42 +1200 Subject: [PATCH] Fix rare failure in cluster test. Don't allow synchronized scans of the table used in the "cluster" regression test, because the conditional locking strategy used for synchronization means that even a non-concurrent scan of a table from the same session causes nondeterminism in subsequent scans. Back-patch to 9.6 when the test arrived. Discussion: https://postgr.es/m/CA%2BhUKGLTK6ZuEkpeJ05-MEmvmgZveCh%2B_w013m7%2ByKWFSmRcDA%40mail.gmail.com --- src/test/regress/expected/cluster.out | 3 +++ src/test/regress/sql/cluster.sql | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index bdae8fe00c..6e3191b84e 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -452,6 +452,8 @@ create table clstr_4 as select * from tenk1; create index cluster_sort on clstr_4 (hundred, thousand, tenthous); -- ensure we don't use the index in CLUSTER nor the checking SELECTs set enable_indexscan = off; +-- make sure our test will always read blocks from the start of the table +set synchronize_seqscans = off; -- Use external sort: set maintenance_work_mem = '1MB'; cluster clstr_4 using cluster_sort; @@ -464,6 +466,7 @@ where row(hundred, thousand, tenthous) <= row(lhundred, lthousand, ltenthous); ---------+----------+----------+-----------+----------+----------- (0 rows) +reset synchronize_seqscans; reset enable_indexscan; reset maintenance_work_mem; -- test CLUSTER on expression index diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql index 188183647c..1bd5e933e8 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -210,6 +210,9 @@ create index cluster_sort on clstr_4 (hundred, thousand, tenthous); -- ensure we don't use the index in CLUSTER nor the checking SELECTs set enable_indexscan = off; +-- make sure our test will always read blocks from the start of the table +set synchronize_seqscans = off; + -- Use external sort: set maintenance_work_mem = '1MB'; cluster clstr_4 using cluster_sort; @@ -219,6 +222,7 @@ select * from tenthous, lag(tenthous) over () as ltenthous from clstr_4) ss where row(hundred, thousand, tenthous) <= row(lhundred, lthousand, ltenthous); +reset synchronize_seqscans; reset enable_indexscan; reset maintenance_work_mem; -- 2.20.1