pgsql: Don't test HEAP_XMAX_INVALID when freezing xmax. - Mailing list pgsql-committers

From Peter Geoghegan
Subject pgsql: Don't test HEAP_XMAX_INVALID when freezing xmax.
Date
Msg-id E1oxupK-000WwJ-Ud@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Don't test HEAP_XMAX_INVALID when freezing xmax.

We shouldn't ever need to rely on whether HEAP_XMAX_INVALID is set in
t_infomask when considering whether or not an xmax should be deemed
already frozen, since that status flag is just a hint.  The only
acceptable representation for an "xmax_already_frozen" raw xmax field is
the transaction ID value zero (also known as InvalidTransactionId).

Adjust code that superficially appeared to rely on HEAP_XMAX_INVALID to
make the rule about xmax_already_frozen clear.  Also avoid needlessly
rereading the tuple's raw xmax.

Oversight in bugfix commit d2599ecf.  There is no evidence that this
ever led to incorrect behavior, so no backpatch.  The worst consequence
of this bug was that VACUUM could hypothetically fail to notice and
report on certain kinds of corruption, which seems fairly benign.

Author: Peter Geoghegan <pg@bowt.ie>
Discussion: https://postgr.es/m/CAH2-Wzkh3DMCDRPfhZxj9xCq9v3WmzvmbiCpf1dNKUBPadhCbQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/02d647bbf0576ebb87f9dc24e1db4dd034f04048

Modified Files
--------------
src/backend/access/heap/heapam.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)


pgsql-committers by date:

Previous
From: Andrew Dunstan
Date:
Subject: pgsql: Fix perl warning from commit 9b4eafcaf4
Next
From: Peter Geoghegan
Date:
Subject: pgsql: Simplify vacuum_set_xid_limits() signature.