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

Commit0811f76

Browse files
committed
pg_surgery: Try to stabilize regression tests.
According to buildfarm member sungazer, the behavior of VACUUM can beunstable in these tests even if we prevent autovacuum from running onthe tables in question, apparently because even a manual vacuum canbehave differently depending on whether anything else is running thatholds back the global xmin. So use a temporary table instead, whichas of commita7212be enablesvacuuming using a more aggressive cutoff.This approach can't be used for the regression test that involves amaterialized view, but that test doesn't run vacuum, so it shouldn'tbe prone to this particular failure mode.Analysis by Tom Lane. Patch by Ashutosh Sharma and me.Discussion:http://postgr.es/m/665524.1599948007@sss.pgh.pa.us
1 parent24fb35e commit0811f76

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

‎contrib/pg_surgery/expected/heap_surgery.out

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
create extension pg_surgery;
22
-- create a normal heap table and insert some rows.
3-
-- note that we don't commit the transaction, so autovacuum can't interfere.
4-
begin;
5-
create table htab(a int);
3+
-- use a temp table so that vacuum behavior doesn't depend on global xmin
4+
create temp table htab (a int);
65
insert into htab values (100), (200), (300), (400), (500);
76
-- test empty TID array
87
select heap_force_freeze('htab'::regclass, ARRAY[]::tid[]);
@@ -85,9 +84,9 @@ NOTICE: skipping tid (0, 6) for relation "htab" because the item number is out
8584

8685
(1 row)
8786

88-
rollback;
8987
-- set up a new table with a redirected line pointer
90-
create table htab2(a int) with (autovacuum_enabled = off);
88+
-- use a temp table so that vacuum behavior doesn't depend on global xmin
89+
create temp table htab2(a int);
9190
insert into htab2 values (100);
9291
update htab2 set a = 200;
9392
vacuum htab2;
@@ -175,6 +174,5 @@ ERROR: "vw" is not a table, materialized view, or TOAST table
175174
select heap_force_freeze('vw'::regclass, ARRAY['(0, 1)']::tid[]);
176175
ERROR: "vw" is not a table, materialized view, or TOAST table
177176
-- cleanup.
178-
drop table htab2;
179177
drop view vw;
180178
drop extension pg_surgery;

‎contrib/pg_surgery/sql/heap_surgery.sql

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
create extension pg_surgery;
22

33
-- create a normal heap table and insert some rows.
4-
-- note that we don't commit the transaction, so autovacuum can't interfere.
5-
begin;
6-
createtablehtab(aint);
4+
-- use a temp table so that vacuum behavior doesn't depend on global xmin
5+
create temp table htab (aint);
76
insert into htabvalues (100), (200), (300), (400), (500);
87

98
-- test empty TID array
@@ -38,10 +37,9 @@ select ctid, xmax from htab where xmin = 2;
3837
-- out-of-range TIDs should be skipped
3938
select heap_force_freeze('htab'::regclass, ARRAY['(0, 0)','(0, 6)']::tid[]);
4039

41-
rollback;
42-
4340
-- set up a new table with a redirected line pointer
44-
createtablehtab2(aint) with (autovacuum_enabled= off);
41+
-- use a temp table so that vacuum behavior doesn't depend on global xmin
42+
create temp table htab2(aint);
4543
insert into htab2values (100);
4644
update htab2set a=200;
4745
vacuum htab2;
@@ -86,6 +84,5 @@ select heap_force_kill('vw'::regclass, ARRAY['(0, 1)']::tid[]);
8684
select heap_force_freeze('vw'::regclass, ARRAY['(0, 1)']::tid[]);
8785

8886
-- cleanup.
89-
droptable htab2;
9087
dropview vw;
9188
drop extension pg_surgery;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp