Re: [PATCH] Logical decoding of TRUNCATE

Поиск
Список
Период
Сортировка
От Noah Misch
Тема Re: [PATCH] Logical decoding of TRUNCATE
Дата
Msg-id 20201221093904.GA3777719@rfd.leadboat.com
обсуждение исходный текст
Ответ на Re: [PATCH] Logical decoding of TRUNCATE  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
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.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Smith
Дата:
Сообщение: Re: Single transaction in the tablesync worker?
Следующее
От: Peter Smith
Дата:
Сообщение: Re: Single transaction in the tablesync worker?