Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit01d56ee

Browse files
committed
Fix test of pg_stat_io for wal_level=minimal.
Back-patch to v16, which introduced the test.
1 parente251e78 commit01d56ee

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

‎contrib/amcheck/expected/check_heap.out

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,15 @@ INSERT INTO heaptest (a, b)
7676
--
7777
-- Create an alternative tablespace and move the heaptest table to it, causing
7878
-- it to be rewritten and all the blocks to reliably evicted from shared
79-
-- buffers -- guaranteeing actual reads when we next select from it.
79+
-- buffers -- guaranteeing actual reads when we next select from it in the
80+
-- same transaction. The heaptest table is smaller than the default
81+
-- wal_skip_threshold, so a wal_level=minimal commit reads the table into
82+
-- shared_buffers. A transaction delays that and excludes any autovacuum.
8083
SET allow_in_place_tablespaces = true;
8184
CREATE TABLESPACE regress_test_stats_tblspc LOCATION '';
8285
SELECT sum(reads) AS stats_bulkreads_before
8386
FROM pg_stat_io WHERE context = 'bulkread' \gset
87+
BEGIN;
8488
ALTER TABLE heaptest SET TABLESPACE regress_test_stats_tblspc;
8589
-- Check that valid options are not rejected nor corruption reported
8690
-- for a non-empty table
@@ -104,6 +108,7 @@ SELECT * FROM verify_heapam(relation := 'heaptest', startblock := 0, endblock :=
104108
-------+--------+--------+-----
105109
(0 rows)
106110

111+
COMMIT;
107112
-- verify_heapam should have read in the page written out by
108113
-- ALTER TABLE ... SET TABLESPACE ...
109114
-- causing an additional bulkread, which should be reflected in pg_stat_io.

‎contrib/amcheck/sql/check_heap.sql

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,23 @@ INSERT INTO heaptest (a, b)
3636
--
3737
-- Create an alternative tablespace and move the heaptest table to it, causing
3838
-- it to be rewritten and all the blocks to reliably evicted from shared
39-
-- buffers -- guaranteeing actual reads when we next select from it.
39+
-- buffers -- guaranteeing actual reads when we next select from it in the
40+
-- same transaction. The heaptest table is smaller than the default
41+
-- wal_skip_threshold, so a wal_level=minimal commit reads the table into
42+
-- shared_buffers. A transaction delays that and excludes any autovacuum.
4043
SET allow_in_place_tablespaces= true;
4144
CREATETABLESPACEregress_test_stats_tblspc LOCATION'';
4245
SELECTsum(reads)AS stats_bulkreads_before
4346
FROM pg_stat_ioWHERE context='bulkread' \gset
47+
BEGIN;
4448
ALTERTABLE heaptestSET TABLESPACE regress_test_stats_tblspc;
45-
4649
-- Check that valid options are not rejected nor corruption reported
4750
-- for a non-empty table
4851
SELECT*FROM verify_heapam(relation :='heaptest', skip :='none');
4952
SELECT*FROM verify_heapam(relation :='heaptest', skip :='all-frozen');
5053
SELECT*FROM verify_heapam(relation :='heaptest', skip :='all-visible');
5154
SELECT*FROM verify_heapam(relation :='heaptest', startblock :=0, endblock :=0);
55+
COMMIT;
5256

5357
-- verify_heapam should have read in the page written out by
5458
-- ALTER TABLE ... SET TABLESPACE ...

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp