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: Ensure snapshot is registered within ScanPgRelation().
Date: Sat, 28 Mar 2020 19:29:57 +0000
Message-ID: <E1jIH9Z-0002iw-GM@gemulon.postgresql.org> (raw)

Ensure snapshot is registered within ScanPgRelation().

In 9.4 I added support to use a historical snapshot in
ScanPgRelation(), while adding logical decoding. Unfortunately a
conflict with the concurrent removal of SnapshotNow was incorrectly
resolved, leading to an unregistered snapshot being used.

It is not correct to use an unregistered (or non-active) snapshot for
anything non-trivial, because catalog invalidations can cause the
snapshot to be invalidated.

Luckily it seems unlikely to actively cause problems in practice, as
ScanPgRelation() requires that we already have a lock on the relation,
we only look for a single row, and we don't appear to rely on the
result's tid to be correct. It however is clearly wrong and potential
negative consequences would likely be hard to find. So it seems worth
backpatching the fix, even without a concrete hazard.

Discussion: https://postgr.es/m/20200229052459.wzhqnbhrriezg4v2@alap3.anarazel.de
Backpatch: 9.5-

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/00a0a428ef503d50b74b8a08d6365a4a0ce04c14

Modified Files
--------------
src/backend/utils/cache/relcache.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1jIH9Z-0002iw-GM@gemulon.postgresql.org>
Permalink:  ../E1jIH9Z-0002iw-GM@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jIH9Z-0002iw-GM@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: Ensure snapshot is registered within ScanPgRelation().
  In-Reply-To: <E1jIH9Z-0002iw-GM@gemulon.postgresql.org>
  References: <E1jIH9Z-0002iw-GM@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