Re: logical decoding of two-phase transactions - Mailing list pgsql-hackers

From Stas Kelvich
Subject Re: logical decoding of two-phase transactions
Date
Msg-id A434797D-1283-42C5-8CE5-7F1CD0B68F36@postgrespro.ru
Whole thread Raw
In response to Re: logical decoding of two-phase transactions  (Andres Freund <andres@anarazel.de>)
Responses Re: logical decoding of two-phase transactions  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
> On 28 Mar 2017, at 00:25, Andres Freund <andres@anarazel.de> wrote:
>
> Hi,
>
> On 2017-03-28 00:19:29 +0300, Stas Kelvich wrote:
>> Ok, here it is.
>
> On a very quick skim, this doesn't seem to solve the issues around
> deadlocks of prepared transactions vs. catalog tables.  What if the
> prepared transaction contains something like LOCK pg_class; (there's a
> lot more realistic examples)? Then decoding won't be able to continue,
> until that transaction is committed / aborted?

But why is that deadlock? Seems as just lock.

In case of prepared lock of pg_class decoding will wait until it committed and
then continue to decode. As well as anything in postgres that accesses pg_class,
including inability to connect to database and bricking database if you accidentally
disconnected before committing that tx (as you showed me some while ago :-).

IMO it is issue of being able to prepare such lock, than of decoding.

Is there any other scenarios where catalog readers are blocked except explicit lock
on catalog table? Alters on catalogs seems to be prohibited.

Stas Kelvich
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company





pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: [POC] hash partitioning
Next
From: Ashutosh Sharma
Date:
Subject: Re: [sqlsmith] Failed assertion in _hash_kill_items/MarkBufferDirtyHint