pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: amcheck: Fix ordering bug in update_cached_xid_range()
Date: Sat, 11 Mar 2023 22:55:08 +0000
Message-ID: <E1pb87H-0034zm-NM@gemulon.postgresql.org> (raw)

amcheck: Fix ordering bug in update_cached_xid_range()

The initialization order in update_cached_xid_range() was wrong, calling
FullTransactionIdFromXidAndCtx() before setting
->next_xid. FullTransactionIdFromXidAndCtx() uses ->next_xid.

In most situations this will not cause visible issues, because the next call
to update_cached_xid_range() will use a less wrong ->next_xid. It's rare that
xids advance fast enough for this to be a problem.

Found while adding more asserts to the 64bit xid infrastructure.

Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com>
Discussion: https://postgr.es/m/20230108002923.cyoser3ttmt63bfn@awork3.anarazel.de
Backpatch: 14-, where heapam verification was introduced

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/16327240da29b70e41a65d49212b31da9a94e177

Modified Files
--------------
contrib/amcheck/verify_heapam.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)



view thread (3+ messages)

Message-ID: <E1pb87H-0034zm-NM@gemulon.postgresql.org>
Permalink:  ../E1pb87H-0034zm-NM@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pb87H-0034zm-NM@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: amcheck: Fix ordering bug in update_cached_xid_range()
  In-Reply-To: <E1pb87H-0034zm-NM@gemulon.postgresql.org>
  References: <E1pb87H-0034zm-NM@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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