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: Use correct horizon when vacuuming catalog relations.
Date: Mon, 21 Jun 2021 12:29:12 +0000
Message-ID: <E1lvJ3A-00083y-Ip@gemulon.postgresql.org> (raw)

Use correct horizon when vacuuming catalog relations.

In dc7420c2c92 I (Andres) accidentally used
RelationIsAccessibleInLogicalDecoding() as the sole condition to use the
non-shared catalog horizon in GetOldestNonRemovableTransactionId(). That is
incorrect, as RelationIsAccessibleInLogicalDecoding() checks whether wal_level
is logical.

The correct check, as done e.g. in GlobalVisTestFor(), is to check
IsCatalogRelation() and RelationIsAccessibleInLogicalDecoding().

The observed misbehavior of this bug was that there could be an endless loop
in lazy_scan_prune(), because the horizons used in heap_page_prune() and the
individual tuple liveliness checks did not match. Likely there are other
potential consequences as well.

A later commit will unify the determination which horizon has to be used, and
add additional assertions to make it easier to catch a bug like this.

Reported-By: Justin Pryzby <pryzby@telsasoft.com>
Diagnosed-By: Matthias van de Meent <boekewurm+postgres@gmail.com>
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/CAEze2Wg32Y9+WJfw=aofkRx1ZRFt_Ev6bNPc4PSaz7PjSFtZgQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5a1e1d83022b976ebdec5cfa8f255c4278b75b8e

Modified Files
--------------
src/backend/storage/ipc/procarray.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)



Message-ID: <E1lvJ3A-00083y-Ip@gemulon.postgresql.org>
Permalink:  ../E1lvJ3A-00083y-Ip@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lvJ3A-00083y-Ip@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: Use correct horizon when vacuuming catalog relations.
  In-Reply-To: <E1lvJ3A-00083y-Ip@gemulon.postgresql.org>
  References: <E1lvJ3A-00083y-Ip@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