Skip to content

Commit 5abca4b

Browse files
committed
Fix test failure with wal_level=minimal.
The newly-added gist pageinspect test prints the LSNs of GiST pages, expecting them all to be 1 (GistBuildLSN). But with wal_level=minimal, they got updated by the whole-relation WAL-logging at commit. Fix by wrapping the problematic tests in the same transaction with the CREATE INDEX. Per buildfarm failure on thorntail. Discussion: https://www.postgresql.org/message-id/3B4F97E5-40FB-4142-8CAA-B301CDFBF982%40iki.fi
1 parent 06ed235 commit 5abca4b

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

contrib/pageinspect/expected/gist.out

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
-- The gist_page_opaque_info() function prints the page's LSN. Normally,
2+
-- that's constant 1 (GistBuildLSN) on every page of a freshly built GiST
3+
-- index. But with wal_level=minimal, the whole relation is dumped to WAL at
4+
-- the end of the transaction if it's smaller than wal_skip_threshold, which
5+
-- updates the LSNs. Wrap the tests on gist_page_opaque_info() in the
6+
-- same transaction with the CREATE INDEX so that we see the LSNs before
7+
-- they are possibly overwritten at end of transaction.
8+
BEGIN;
9+
-- Create a test table and GiST index.
110
CREATE TABLE test_gist AS SELECT point(i,i) p, i::text t FROM
211
generate_series(1,1000) i;
312
CREATE INDEX test_gist_idx ON test_gist USING gist (p);
@@ -20,6 +29,7 @@ SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 2));
2029
0/1 | 0/0 | 1 | {leaf}
2130
(1 row)
2231

32+
COMMIT;
2333
SELECT * FROM gist_page_items(get_raw_page('test_gist_idx', 0), 'test_gist_idx');
2434
itemoffset | ctid | itemlen | keys
2535
------------+-----------+---------+-------------------

contrib/pageinspect/sql/gist.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
-- The gist_page_opaque_info() function prints the page's LSN. Normally,
2+
-- that's constant 1 (GistBuildLSN) on every page of a freshly built GiST
3+
-- index. But with wal_level=minimal, the whole relation is dumped to WAL at
4+
-- the end of the transaction if it's smaller than wal_skip_threshold, which
5+
-- updates the LSNs. Wrap the tests on gist_page_opaque_info() in the
6+
-- same transaction with the CREATE INDEX so that we see the LSNs before
7+
-- they are possibly overwritten at end of transaction.
8+
BEGIN;
9+
10+
-- Create a test table and GiST index.
111
CREATE TABLE test_gist AS SELECT point(i,i) p, i::text t FROM
212
generate_series(1,1000) i;
313
CREATE INDEX test_gist_idx ON test_gist USING gist (p);
@@ -7,6 +17,8 @@ SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 0));
717
SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 1));
818
SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 2));
919

20+
COMMIT;
21+
1022
SELECT * FROM gist_page_items(get_raw_page('test_gist_idx', 0), 'test_gist_idx');
1123
SELECT * FROM gist_page_items(get_raw_page('test_gist_idx', 1), 'test_gist_idx') LIMIT 5;
1224

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy