pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexey Kondratov <a.kondratov@postgrespro.ru>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Craig Ringer <craig.ringer@enterprisedb.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit
Date: Wed, 25 Nov 2020 13:04:01 +0300
Message-ID: <6e6aa41c9cdde9d4e5572385e108d68e@postgrespro.ru> (raw)
In-Reply-To: <CALj2ACU7QwViOwSFCejUGZvTWKhmHoXoXD0Egf9vtCNv36s+Uw@mail.gmail.com>
References: <CALj2ACVvrp5=AVp2PupEm+nAC8S4buqR3fJMmaCoc7ftT0aD2A@mail.gmail.com>
	<CALj2ACVKQeXJ2okDDDiSC5y6i1tfd3P+n7-5iwqnQ=JiOxUyMA@mail.gmail.com>
	<160467818521.7362.11186359886835925531.pgcf@coridan.postgresql.org>
	<6df6525ca7a4b54a4a39f55e4dd6b3e9@postgrespro.ru>
	<CALj2ACVODykNQQAuz3Veh5S9J3QfAi4D9CsExguMhYB4-+-YGw@mail.gmail.com>
	<f58d1df4ae58f6cf3bfa560f923462e0@postgrespro.ru>
	<CALj2ACX4B9sBTKPg70TzKfPfPJ=ndocU6hY5jii5wDvzW2X2DQ@mail.gmail.com>
	<c22ad9fcdba6ab768ec2ea86d33d0c18@postgrespro.ru>
	<CALj2ACW+PzzuqE6YOueNUi5Zek9XTv9P3FXdT4XF3-1JDk4RuA@mail.gmail.com>
	<CALj2ACU0gf_Xf2sAtrCRhvLc-G42UqLGthDfVC9G1jzUpBcQ1w@mail.gmail.com>
	<1f29ad3f1d8b969dfde6d500bbd9d82d@postgrespro.ru>
	<CALj2ACVq99r+s04tWrD8TBG6QOfa=r1j0JXvKbO6JFmrMgdWpg@mail.gmail.com>
	<be224d0520df0594b0693c95bd19fe0a@postgrespro.ru>
	<CAGRY4nxdswS_s2=XSD3TEVeKdruaz476R6svSmcx9vuJENFVOg@mail.gmail.com>
	<CALj2ACU7QwViOwSFCejUGZvTWKhmHoXoXD0Egf9vtCNv36s+Uw@mail.gmail.com>

On 2020-11-25 06:17, Bharath Rupireddy wrote:
> On Wed, Nov 25, 2020 at 7:24 AM Craig Ringer
> <craig.ringer@enterprisedb.com> wrote:
>> 
>> A quick thought here.
>> 
>> Would it make sense to add a hook in the DISCARD ALL implementation 
>> that postgres_fdw can register for?
>> 
>> There's precedent here, since DISCARD ALL already has the same effect 
>> as SELECT pg_advisory_unlock_all(); amongst other things.
>> 
> 
> IIUC, then it is like a core(server) function doing some work for the
> postgres_fdw module. Earlier in the discussion, one point raised was
> that it's better not to have core handling something related to
> postgres_fdw. This is the reason we have come up with postgres_fdw
> specific function and a GUC, which get defined when extension is
> created. Similarly, dblink also has it's own bunch of functions one
> among them is dblink_disconnect().
> 

If I have got Craig correctly, he proposed that we already have a 
DISCARD ALL statement, which is processed by DiscardAll(), and it 
releases internal resources known from the core perspective. That way, 
we can introduce a general purpose hook DiscardAll_hook(), so 
postgres_fdw can get use of it to clean up its own resources 
(connections in our context) if needed. In other words, it is not like a 
core function doing some work for the postgres_fdw module, but rather 
like a callback/hook, that postgres_fdw is able to register to do some 
additional work.

It can be a good replacement for 0001, but won't it be already an 
overkill to drop all local caches along with remote connections? I mean, 
that it would be a nice to have hook from the extensibility perspective, 
but postgres_fdw_disconnect() still makes sense, since it does a very 
narrow and specific job.


Regards
-- 
Alexey Kondratov

Postgres Professional https://www.postgrespro.com
Russian Postgres Company





view thread (175+ messages)  latest in thread

Message-ID: <6e6aa41c9cdde9d4e5572385e108d68e@postgrespro.ru>
Permalink:  ../6e6aa41c9cdde9d4e5572385e108d68e@postgrespro.ru/
Also on:    postgresql.org/message-id/6e6aa41c9cdde9d4e5572385e108d68e@postgrespro.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: a.kondratov@postgrespro.ru, bharath.rupireddyforpostgres@gmail.com, craig.ringer@enterprisedb.com
  Subject: Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit
  In-Reply-To: <6e6aa41c9cdde9d4e5572385e108d68e@postgrespro.ru>
  References: <CALj2ACVvrp5=AVp2PupEm+nAC8S4buqR3fJMmaCoc7ftT0aD2A@mail.gmail.com> <160467818521.7362.11186359886835925531.pgcf@coridan.postgresql.org> <6df6525ca7a4b54a4a39f55e4dd6b3e9@postgrespro.ru> <CALj2ACVODykNQQAuz3Veh5S9J3QfAi4D9CsExguMhYB4-+-YGw@mail.gmail.com> <f58d1df4ae58f6cf3bfa560f923462e0@postgrespro.ru> <CALj2ACX4B9sBTKPg70TzKfPfPJ=ndocU6hY5jii5wDvzW2X2DQ@mail.gmail.com> <c22ad9fcdba6ab768ec2ea86d33d0c18@postgrespro.ru> <CALj2ACW+PzzuqE6YOueNUi5Zek9XTv9P3FXdT4XF3-1JDk4RuA@mail.gmail.com> <CALj2ACU0gf_Xf2sAtrCRhvLc-G42UqLGthDfVC9G1jzUpBcQ1w@mail.gmail.com> <1f29ad3f1d8b969dfde6d500bbd9d82d@postgrespro.ru> <CALj2ACVq99r+s04tWrD8TBG6QOfa=r1j0JXvKbO6JFmrMgdWpg@mail.gmail.com> <be224d0520df0594b0693c95bd19fe0a@postgrespro.ru> <CAGRY4nxdswS_s2=XSD3TEVeKdruaz476R6svSmcx9vuJENFVOg@mail.gmail.com> <CALj2ACU7QwViOwSFCejUGZvTWKhmHoXoXD0Egf9vtCNv36s+Uw@mail.gmail.com> <6e6aa41c9cdde9d4e5572385e108d68e@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox