pgsql: Test that vacuum removes tuples older than OldestXmin

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Test that vacuum removes tuples older than OldestXmin
Date: 2024-07-19 16:15:25
Message-ID: E1sUqGT-000HlH-77@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Test that vacuum removes tuples older than OldestXmin

If vacuum fails to prune a tuple killed before OldestXmin, it will later
find that tuple dead in lazy_scan_prune() and loop infinitely.

Add a test reproducing this scenario to the recovery suite which creates
a table on a primary, updates the table to generate dead tuples for
vacuum, and then, during the vacuum, uses a replica to force
GlobalVisState->maybe_needed on the primary to move backwards and
precede the value of OldestXmin set at the beginning of vacuuming the
table.

This commit is separate from the fix in case there are test stability
issues.

Discussion of the bug: https://postgr.es/m/CAAKRu_Y_NJzF4-8gzTTeaOuUL3CcGoXPjXcAHbTTygT8AyVqag%40mail.gmail.com
Discussion of the test: https://postgr.es/m/CAAKRu_apNU2MPBK96V%2BbXjTq0RiZ-%3DA4ZTaysakpx9jxbq1dbQ%40mail.gmail.com

Author: Melanie Plageman
Reviewed-by: Peter Geoghegan

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/01e2b7f0fd02a44e1d13357b20fecd79919d9031

Modified Files
--------------
src/test/recovery/t/043_vacuum_horizon_floor.pl | 255 ++++++++++++++++++++++++
1 file changed, 255 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Nathan Bossart 2024-07-19 16:55:33 pgsql: Add overflow checks to money type.
Previous Message Heikki Linnakangas 2024-07-19 07:46:44 pgsql: Move resowner from common JitContext to LLVM specific