Re: locking [user] catalog tables vs 2pc vs logical rep
vignesh C <vignesh21@gmail.com>
From: vignesh C <vignesh21@gmail.com>
To: "osumi.takamichi@fujitsu.com" <osumi.takamichi@fujitsu.com>
Cc: Peter Smith <smithpb2250@gmail.com>, Andres Freund <andres@anarazel.de>, PostgreSQL-development <pgsql-hackers@postgresql.org>,
Amit Kapila <amit.kapila16@gmail.com>, Markus Wanner <markus.wanner@enterprisedb.com>
Date: 2021-06-03T04:08:37Z
Lists: pgsql-hackers
On Thu, Jun 3, 2021 at 9:18 AM osumi.takamichi@fujitsu.com <osumi.takamichi@fujitsu.com> wrote: > > On Tuesday, June 1, 2021 4:33 PM Peter Smith <smithpb2250@gmail.com> > > To: Andres Freund <andres@anarazel.de> > > Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>; Amit Kapila > > <amit.kapila16@gmail.com>; Markus Wanner > > <markus.wanner@enterprisedb.com> > > Subject: Re: locking [user] catalog tables vs 2pc vs logical rep > > > > Hi. > > > > The attached PG docs patch about catalog deadlocks was previously > > implemented in another thread [1], but it seems more relevant to this one. > > > > PSA. > Thank you for providing the patch. > I have updated your patch to include some other viewpoints. > > For example, CLUSTER command scenario > that also causes hang of PREPARE in synchronous mode. > We get this deadlock, using the 2PC patch-set. > > FYI, the scenario is > (1) create a table with a trigger > (2) create pub and sub in synchronous mode > (3) then, execute CLUSTER pg_trigger USING pg_trigger_oid_index, > and do some operations (e.g. INSERT) on the trigger-attached table and PREPARE > > The mechanism of this is > walsender tries to take a lock on pg_trigger if the table has a trigger, > but, pg_trigger is already locked by the CLUSTER command, which leads to the deadlock. > Then, this scenario requires some operations on the table which has trigger > because it invokes the walsender to take the lock described above. > > I also included the description about TRUNCATE on user_catalog_table > in the patch. Please have a look at this patch. 1) I was not able to generate html docs with the attached patch: logicaldecoding.sgml:1128: element sect1: validity error : Element sect1 content does not follow the DTD, expecting (sect1info? , (title , subtitle? , titleabbrev?) , (toc | lot | index | glossary | bibliography)* , (((calloutlist | glosslist | bibliolist | itemizedlist | orderedlist | segmentedlist | simplelist | variablelist | caution | important | note | tip | warning | literallayout | programlisting | programlistingco | screen | screenco | screenshot | synopsis | cmdsynopsis | funcsynopsis | classsynopsis | fieldsynopsis | constructorsynopsis | destructorsynopsis | methodsynopsis | formalpara | para | simpara | address | blockquote | graphic | graphicco | mediaobject | mediaobjectco | informalequation | informalexample | informalfigure | informaltable | equation | example | figure | table | msgset | procedure | sidebar | qandaset | task | anchor | bridgehead | remark | highlights | abstract | authorblurb | epigraph | indexterm | beginpage)+ , (refentry* | sect2* | simplesect*)) | refentry+ | sect2+ | simplesect+) , (toc | lot | index | glossary | bibliography)*), got (title sect2 sect2 note ) </sect1> 2) You could change hang to deadlock: + logical decoding of published table within the same transaction leads to a hang. Regards, Vignesh
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