RelationGetNumberOfBlocks called before vacuum_get_cutoffs

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Subject: RelationGetNumberOfBlocks called before vacuum_get_cutoffs
Date: 2025-06-01 16:06:51
Message-ID: CAH2-WzntqvVEdbbpqG5JqSZGuLWmy4PBfUO-OswfivKchr2gvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Commit 052026c9b9 made heap_vacuum_rel call RelationGetNumberOfBlocks
before it calls vacuum_get_cutoffs -- it swapped the order. This is
wrong, as explained by an intact comment above the call to
vacuum_get_cutoffs.

In short, there is now a brief window during which the relation can be
extended that'll allow heap pages with tuple headers < VACUUM's
OldestXmin to be created, which are overlooked by that same VACUUM
(they're beyond the same VACUUM's rel_pages). As a result of all this,
VACUUM might advance pg_class.relfrozenxid to a later/younger value
than a remaining/unfrozen XID value from one of these unscanned heap
pages.

--
Peter Geoghegan

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2025-06-01 16:13:20 Re: CREATE DOMAIN create two not null constraints
Previous Message Tom Lane 2025-06-01 16:04:13 Re: Missing pg_depend entries for constraints created by extensions (deptype 'e')