pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix snapshot handling in logicalmsg_decode
Date: Wed, 22 Feb 2023 16:35:08 +0000
Message-ID: <E1pUs5E-000A7F-8O@gemulon.postgresql.org> (raw)

Fix snapshot handling in logicalmsg_decode

Whe decoding a transactional logical message, logicalmsg_decode called
SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot
yet at that point. We don't actually need the snapshot in this case
(during replay we'll have the snapshot from the transaction), so in
practice this is harmless. But in assert-enabled build this crashes.

Fixed by requesting the snapshot only in non-transactional case, where
we are guaranteed to have SNAPBUILD_CONSISTENT.

Backpatch to 11. The issue exists since 9.6.

Backpatch-through: 11
Reviewed-by: Andres Freund
Discussion: https://postgr.es/m/84d60912-6eab-9b84-5de3-41765a5449e8@enterprisedb.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8b9cbd42b61ff55e5519631bada5d310159e3a5f

Modified Files
--------------
src/backend/replication/logical/decode.c        | 14 ++++++++++++--
src/backend/replication/logical/reorderbuffer.c | 10 ++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1pUs5E-000A7F-8O@gemulon.postgresql.org>
Permalink:  ../E1pUs5E-000A7F-8O@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pUs5E-000A7F-8O@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: tomas.vondra@postgresql.org
  Subject: Re: pgsql: Fix snapshot handling in logicalmsg_decode
  In-Reply-To: <E1pUs5E-000A7F-8O@gemulon.postgresql.org>
  References: <E1pUs5E-000A7F-8O@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