pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedxid_wraparound/002_limits.pl might fail due to transient warning
2+ messages / 2 participants
[nested] [flat]
Commits from this thread:
2026-09-02 e073b64d33 b51dd2b2c5 61636c17b3 75716fe3dd Stabilize xid_wraparound/t/002_limits.pl test.
* xid_wraparound/002_limits.pl might fail due to transient warning
@ 2026-08-01 16:00 Alexander Lakhin <exclusion@gmail.com>
2026-09-02 03:03 ` Re: xid_wraparound/002_limits.pl might fail due to transient warning Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Lakhin @ 2026-08-01 16:00 UTC (permalink / raw)
To: pgsql-hackers
Hello hackers,
New buildfarm animal partridge (aarch64, maybe with slow storage)
produced several unprecedented failures of 002_limits, e.g., [1], [2]:
389/400 xid_wraparound - postgresql:xid_wraparound/002_limits ERROR 601.34s exit status 1
[01:32:22.020](6.936s) not ok 3
[01:32:22.023](0.003s) # Failed test at
/home/buildfarm/pg-buildfarm/builds/HEAD/pgsql/src/test/modules/xid_wraparound/t/002_limits.pl line 130.
[01:32:22.024](0.001s) # got: 'start
# oldxact
# after 1 billion
# after 2 billion
# reached warn-limit
# after VACUUM
# after VACUUM'
# expected: 'start
# oldxact
# after 1 billion
# after 2 billion
# reached warn-limit
# after VACUUM'
That is:
# Wait until autovacuum has processed the other databases and advanced
# the system-wide oldest-XID.
$ret =
$node->poll_query_until('postgres',
qq[INSERT INTO wraparoundtest VALUES ('after VACUUM')],
'INSERT 0 1');
has been successfully executed two times instead of one.
002_limits_wraparound.log contains:
2026-07-24 01:32:21.791 UTC client backend[3424568] 002_limits.pl LOG: statement: INSERT INTO wraparoundtest VALUES
('after VACUUM')
2026-07-24 01:32:21.793 UTC client backend[3424568] 002_limits.pl WARNING: database "template0" must be vacuumed within
87544676 transactions
2026-07-24 01:32:21.793 UTC client backend[3424568] 002_limits.pl DETAIL: Approximately 4.08% of transaction IDs are
available for use.
2026-07-24 01:32:21.793 UTC client backend[3424568] 002_limits.pl HINT: To avoid transaction ID assignment failures,
execute a database-wide VACUUM in that database.
You might also need to commit or roll back old prepared transactions, or drop stale replication slots.
2026-07-24 01:32:21.947 UTC client backend[3424573] 002_limits.pl LOG: statement: INSERT INTO wraparoundtest VALUES
('after VACUUM')
First INSERT succeeded, but with the WARNING, which didn't satisfy
poll_query_until(). I've reproduced similar failures with extra
autovacuum/vacuum settings, but the reproducer is still too
timing-dependent to share, so maybe this illustration will do:
inline patch 1: src/test/modules/xid_wraparound/t/002_limits.pl (+4/-0 lines) download inline-1.patch
--- a/src/test/modules/xid_wraparound/t/002_limits.pl
+++ b/src/test/modules/xid_wraparound/t/002_limits.pl
@@ -95,6 +95,10 @@ is($warn_limit, 1, "warn-limit reached");
# We can still INSERT, despite the warnings.
$node->safe_psql('postgres',
qq[INSERT INTO wraparoundtest VALUES ('reached warn-limit')]);
+$ret =
+ $node->poll_query_until('postgres',
+ qq[INSERT INTO wraparoundtest VALUES ('reached warn-limit')],
+ 'INSERT 0 1');
PROVE_TESTS="t/002*" PG_TEST_EXTRA="xid_wraparound" PG_TEST_TIMEOUT_DEFAULT=5 make -s check -C
src/test/modules/xid_wraparound/
gives:
t/002_limits.pl .. 1/? # poll_query_until timed out executing this query:
# INSERT INTO wraparoundtest VALUES ('reached warn-limit')
# expecting this output:
# INSERT 0 1
# last actual query output:
# INSERT 0 1
# with stderr:
# WARNING: database "postgres" must be vacuumed within 97483575 transactions
# DETAIL: Approximately 4.54% of transaction IDs are available for use.
# HINT: To avoid transaction ID assignment failures, execute a database-wide VACUUM in that database.
# You might also need to commit or roll back old prepared transactions, or drop stale replication slots.
Probably this can be fixed with (it works for my repro):
$ret =
$node->poll_query_until('postgres',
qq[SET client_min_messages='ERROR'; INSERT INTO wraparoundtest VALUES ('after VACUUM')],
"SET\nINSERT 0 1");
[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=partridge&dt=2026-07-22%2011%3A37%3A59
[2] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=partridge&dt=2026-07-24%2000%3A00%3A42
Best regards,
Alexander
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: xid_wraparound/002_limits.pl might fail due to transient warning
2026-08-01 16:00 xid_wraparound/002_limits.pl might fail due to transient warning Alexander Lakhin <exclusion@gmail.com>
@ 2026-09-02 03:03 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2026-09-02 03:03 UTC (permalink / raw)
To: Alexander Lakhin <exclusion@gmail.com>; +Cc: pgsql-hackers
Alexander Lakhin <exclusion@gmail.com> writes:
> Hello hackers,
> New buildfarm animal partridge (aarch64, maybe with slow storage)
> produced several unprecedented failures of 002_limits, e.g., [1], [2]:
I went looking at this tonight and then found your message. I think
the reason we're not seeing a lot of these in the buildfarm is that
not that many animals are running this test suite (it requires putting
xid_wraparound in PG_TEST_EXTRA). I concur with your conclusion that
poll_query_until is iterating the INSERT an extra time, but I think
a less magic solution would be to just change the test's match rule
to allow that to happen, more or less as attached.
regards, tom lane
Attachments:
stabilize-002_limits-wraparound-test.patch (text/x-diff, 1.0K) download
diff --git a/src/test/modules/xid_wraparound/t/002_limits.pl b/src/test/modules/xid_wraparound/t/002_limits.pl
index 29d071a677b..ca2604d0c0d 100644
--- a/src/test/modules/xid_wraparound/t/002_limits.pl
+++ b/src/test/modules/xid_wraparound/t/002_limits.pl
@@ -126,14 +126,20 @@ $ret =
qq[INSERT INTO wraparoundtest VALUES ('after VACUUM')],
'INSERT 0 1');
-# Check the table contents
+# Check the table contents. It's possible for more than one "after VACUUM"
+# entry to appear, because there is a window where the preceding INSERT will
+# succeed but also produce a warning message about impending wraparound.
+# poll_query_until won't accept that as a valid result, so it iterates an
+# additional time or times until the INSERT succeeds cleanly. So, we use
+# a "like" test that won't complain about extra data.
$ret = $node->safe_psql('postgres', qq[SELECT * from wraparoundtest]);
-is( $ret, "start
+like(
+ $ret, qr/^start
oldxact
after 1 billion
after 2 billion
reached warn-limit
-after VACUUM");
+after VACUUM/);
$node->stop;
done_testing();
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-09-02 03:03 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-01 16:00 xid_wraparound/002_limits.pl might fail due to transient warning Alexander Lakhin <exclusion@gmail.com>
2026-09-02 03:03 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox