Re: locking [user] catalog tables vs 2pc vs logical rep
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Petr Jelinek <petr.jelinek@enterprisedb.com>
Cc: Michael Paquier <michael@paquier.xyz>, vignesh C <vignesh21@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
Ajin Cherian <itsajin@gmail.com>, Andres Freund <andres@anarazel.de>,
Pg Hackers <pgsql-hackers@postgresql.org>, Markus Wanner <markus.wanner@enterprisedb.com>
Date: 2021-05-26T09:30:03Z
Lists: pgsql-hackers
On Wed, May 26, 2021 at 1:53 PM Petr Jelinek <petr.jelinek@enterprisedb.com> wrote: > > On 26 May 2021, at 05:04, Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > On Tue, May 25, 2021 at 12:40 PM Michael Paquier <michael@paquier.xyz> wrote: > >> > >> It seems to me that the 2PC issues on catalog tables and the issues > >> related to logical replication in synchonous mode are two distinct > >> things that need to be fixed separately. > >> > > > > Fair enough. But the way we were looking at them as they will also > > block (lead to deadlock) for logical replication of prepared > > transactions and also logical replication in synchonous mode without > > prepared transactions. Now, if we want to deal with the 2PC issues > > separately that should be fine as well. However, for that we need to > > see which all operations we want to block on [user]_catalog_tables. > > The first one is lock command, then there are other operations like > > Cluster which take exclusive lock on system catalog tables and we > > allow them to be part of prepared transactions (example Cluster > > pg_trigger using pg_trigger_oid_index;), another kind of operation is > > Truncate on user_catalog_tables. Now, some of these might not allow > > connecting after restart so we might need to think whether we want to > > prohibit all such operations or only some of them. > > > > > IIRC this was discussed the first time 2PC decoding was proposed and everybody seemed fine with the limitation so I'd vote for just documenting it, same way as the sync rep issue. > +1. > If you'd prefer fixing it by blocking something, wouldn't it make more sense to simply not allow PREPARE if one of these operations was executed, similarly to what we do with temp table access? > The point was that even if somehow we block for prepare, there doesn't seem to be a simple way for synchronous logical replication which can also have similar problems. So, I would prefer to document it and we can even think to backpatch the sync rep related documentation. Michael seems to be a bit interested in dealing with some of the 2PC issues due to reasons different than logical replication which I am not completely sure is a good idea and Tom also feels that is not a good idea. -- With Regards, Amit Kapila.
Commits
-
Doc: Update caveats in synchronous logical replication.
- 4be39ef9cbc5 9.6.23 landed
- f365151a5392 10.18 landed
- e00e5db22d79 11.13 landed
- a73bd49c69e1 12.8 landed
- 7a4ecefe9d77 13.4 landed
- c66fb78ebb4f 14.0 landed
-
Document a few caveats in synchronous logical replication.
- acdb523cb642 9.6.23 landed
- ff33be61f212 10.18 landed
- 5a456034b84e 11.13 landed
- 9f7bba2629cf 13.4 landed
- eb231dbd80d2 12.8 landed
- 3cb828dbe260 14.0 landed
-
Update the docs and comments for decoding of prepared xacts.
- b4e3dc7fd420 14.0 landed
-
Allow decoding at prepare time in ReorderBuffer.
- a271a1b50e9b 14.0 cited
-
Documentation for logical decoding.
- 49c0864d7ef5 9.4.0 cited