Re: logical replication worker accesses catalogs in error context callback
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>,
Andres Freund <andres@anarazel.de>, PostgreSQL-development <pgsql-hackers@postgresql.org>,
Peter Eisentraut <peter_e@gmx.net>, Alvaro Herrera <alvherre@alvh.no-ip.org>,
Amit Kapila <amit.kapila16@gmail.com>
Date: 2021-04-14T12:06:04Z
Lists: pgsql-hackers
Attachments
- v5-0001-Avoid-Catalogue-Accesses-In-slot_store_error_call.patch (application/x-patch) patch v5-0001
On Wed, Mar 17, 2021 at 4:52 PM Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> wrote: > > On Tue, Mar 16, 2021 at 2:21 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > > > Thanks for pointing to the changes in the commit message. I corrected > > > them. Attaching v4 patch set, consider it for further review. > > > > I took a quick look at this. I'm quite worried about the potential > > performance cost of the v4-0001 patch (the one for fixing > > slot_store_error_callback). Previously, we didn't pay any noticeable > > cost for having the callback unless there actually was an error. > > As patched, we perform several catalog lookups per column per row, > > even in the non-error code path. That seems like it'd be a noticeable > > performance hit. Just to add insult to injury, it leaks memory. > > > > I propose a more radical but simpler solution: let's just not bother > > with including the type names in the context message. How much are > > they really buying? > > Thanks. In that case, the message can only return the local and remote > columns names and ignore the types (something like below). And the > user will have to figure out what are the types of those columns in > local and remote separately in case of error. Then the function > logicalrep_typmap_gettypname can also be removed. I'm not sure if this > is okay. Thoughts? Hi Tom, As suggested earlier, I'm attaching a v5 patch that avoids printing the column type names in the context message thus no cache lookups have to be done in the error context callback. I think the column name is enough to know on which column the error occurred and if required it's type can be known by the user. This patch gets rid of printing local and remote type names in slot_store_error_callback and also logicalrep_typmap_gettypname because it's unnecessary. I'm not sure if this solution is acceptable. Thoughts? With Regards, Bharath Rupireddy. EnterpriseDB: http://www.enterprisedb.com
Commits
-
Avoid doing catalog lookups in postgres_fdw's conversion_error_callback.
- bee18616a650 13.4 landed
- bd2e68d0bf94 12.8 landed
- b23ac5aefae4 10.18 landed
- a9460dbf1577 11.13 landed
- 67f925bbd9de 9.6.23 landed
- c7b7311f6177 15.0 landed
- 86d4914210e9 14.0 landed
-
Don't try to print data type names in slot_store_error_callback().
- 63a952167092 14.0 landed
- feff6155734e 12.8 landed
- 7fc97752d566 13.4 landed
- 50371df266d4 15.0 landed
- 32d50b895217 11.13 landed
- 0b5089e8c979 10.18 landed
-
logical replication: fix OID type mapping mechanism
- 24c0a6c64976 11.0 cited
-
Improve sys/catcache performance.
- 141fd1b66ce6 11.0 cited
-
Logical replication
- 665d1fad99e7 10.0 cited