From: Noah Misch <noah@leadboat.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Andres Freund <andres@anarazel.de>
Cc: Marco Nenciarini <marco.nenciarini@2ndquadrant.it>
Cc: Petr Jelinek <petr.jelinek@2ndquadrant.com>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] Logical decoding of TRUNCATE
Date: Mon, 21 Dec 2020 01:39:04 -0800
Message-ID: <20201221093904.GA3777719@rfd.leadboat.com> (raw)
In-Reply-To: <CAA4eK1KXpXV2DqEc32WKmpPQJvKNLm9RD0jCqV7BGYLGK=Oo7Q@mail.gmail.com>
References: <20180405170712.av633jvnnizmd5sn@alvherre.pgsql>
<1baed811-47b2-5b7d-c641-4b7eb01d650f@2ndquadrant.com>
<20201220041319.GA3602688@rfd.leadboat.com>
<CAA4eK1KXpXV2DqEc32WKmpPQJvKNLm9RD0jCqV7BGYLGK=Oo7Q@mail.gmail.com>
On Sun, Dec 20, 2020 at 03:54:31PM -0800, Peter Geoghegan wrote:
> On Sun, Dec 20, 2020 at 3:13 PM Andres Freund <andres@anarazel.de> wrote:
> > Hm. Do I understand correctly that this problem is hit solely because
> > the parallel mode code relies on there already have been a transaction
> > snapshot set, thus avoiding the error? And that the code normally only
> > works because GetTransactionSnapshot() will already have been called
> > somewhere, before EnterParallelMode()?
I think so.
> It seems unlikely that InitializeParallelDSM() was ever intended to be
> run in a background worker.
That wouldn't surprise me. Nonetheless, when worker_spi runs parallel
queries, they work fine. The logical replication worker experiences novel
scenarios, because it calls ExecuteTruncateGuts() directly, not as part of an
actual TRUNCATE query. That bypasses some of the usual once-per-query setup.
On Mon, Dec 21, 2020 at 12:29:37PM +0530, Amit Kapila wrote:
> I think the TRUNCATE operation should not use parallelism either via
> apply worker or without it because there is nothing to scan in heap.
That's fair.
> Additionally, we can have an Assert or elog in InitializeParallelDSM
> to ensure that it is never invoked by parallel worker.
I don't know whether InitializeParallelDSM() operates correctly from inside a
parallel worker. That is orthogonal to the bug here.
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-general@postgresql.org
Cc: noah@leadboat.com, amit.kapila16@gmail.com, peter.eisentraut@2ndquadrant.com, alvherre@alvh.no-ip.org, andres@anarazel.de, marco.nenciarini@2ndquadrant.it, petr.jelinek@2ndquadrant.com, thomas.munro@enterprisedb.com, simon@2ndquadrant.com, pgsql-hackers@postgresql.org
Subject: Re: [PATCH] Logical decoding of TRUNCATE
In-Reply-To: <20201221093904.GA3777719@rfd.leadboat.com>
References: <20180405170712.av633jvnnizmd5sn@alvherre.pgsql> <1baed811-47b2-5b7d-c641-4b7eb01d650f@2ndquadrant.com> <20201220041319.GA3602688@rfd.leadboat.com> <CAA4eK1KXpXV2DqEc32WKmpPQJvKNLm9RD0jCqV7BGYLGK=Oo7Q@mail.gmail.com> <20201221093904.GA3777719@rfd.leadboat.com>
* 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