pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Rearrange logrep worker's snapshot handling some more.
Date: Thu, 10 Jun 2021 16:27:43 +0000
Message-ID: <E1lrNWx-0005cZ-61@gemulon.postgresql.org> (raw)

Rearrange logrep worker's snapshot handling some more.

It turns out that worker.c's code path for TRUNCATE was also
careless about establishing a snapshot while executing user-defined
code, allowing the checks added by commit 84f5c2908 to fail when
a trigger is fired in that context.

We could just wrap Push/PopActiveSnapshot around the truncate call,
but it seems better to establish a policy of holding a snapshot
throughout execution of a replication step.  To help with that and
possible future requirements, replace the previous ensure_transaction
calls with pairs of begin/end_replication_step calls.

Per report from Mark Dilger.  Back-patch to v11, like the previous
changes.

Discussion: https://postgr.es/m/B4A3AF82-79ED-4F4C-A4E5-CD2622098972@enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3a09d75b4f6cabc8331e228b6988dbfcd9afdfbe

Modified Files
--------------
src/backend/replication/logical/worker.c | 85 ++++++++++++++++++--------------
1 file changed, 48 insertions(+), 37 deletions(-)



view thread (4+ messages)

Message-ID: <E1lrNWx-0005cZ-61@gemulon.postgresql.org>
Permalink:  ../E1lrNWx-0005cZ-61@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lrNWx-0005cZ-61@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Rearrange logrep worker's snapshot handling some more.
  In-Reply-To: <E1lrNWx-0005cZ-61@gemulon.postgresql.org>
  References: <E1lrNWx-0005cZ-61@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