pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: Alexey Kondratov <a.kondratov@postgrespro.ru>
Cc: Hou, Zhijie <houzj.fnst@cn.fujitsu.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, 20 Jan 2021 18:54:09 +0900
Message-ID: <0c53c3da-9bfe-82f0-1190-5f029e92a816@oss.nttdata.com> (raw)
In-Reply-To: <CALj2ACW3p_TLLH_On3Q=EWYoGKLYzi9vxH_isRXYksw5j1mkTQ@mail.gmail.com>
References: <CALj2ACVvrp5=AVp2PupEm+nAC8S4buqR3fJMmaCoc7ftT0aD2A@mail.gmail.com>
	<CALj2ACWFbFau2aUchkLpMOWEPH0ipJEJyh-XjUkZU0985OYJMw@mail.gmail.com>
	<55bd82c5-d133-6fbb-f1f4-e25c1509c96e@oss.nttdata.com>
	<CALj2ACWqsVXK0-Mxcp05KtiUFE2HgWbdiww3uFzVZtdOUSGJ1A@mail.gmail.com>
	<CALj2ACXSQq4XQbpzMYSM3uKUzfqtp3Un9o_yErf1SNxHvDXg6Q@mail.gmail.com>
	<CALNJ-vTHJBFBVnxJ2soHhAg6UrCAD9RgMF9RF6yj5AhTuJM-mg@mail.gmail.com>
	<CALj2ACVEadzaB88ZRVF499nFxdO5pBTMCDJ0xG9kvLVhea0eYg@mail.gmail.com>
	<c2a00f21-a80d-8bce-e2ea-8cd8e16c4da9@oss.nttdata.com>
	<CALj2ACURjjg8wVpfb-s8GE+4ycQcx6z+QGQOM3TC_Cjz+=Lq6w@mail.gmail.com>
	<422884a8-c863-a4d4-cebd-562855c29977@oss.nttdata.com>
	<CALj2ACUv_+qaoYvsy674Aw8Myo-Ydte7b6vRKi3Q8ZmfG+S5Bg@mail.gmail.com>
	<0bc2b366-76d4-9480-5812-6f0de2b3f526@oss.nttdata.com>
	<CALj2ACXMB4Z4ewCeXWx7oOSxzkhqQ4KLeNVZ=NB6=fjhN89n3w@mail.gmail.com>
	<ba9c0824-77b7-16bd-e425-7b1893725eee@oss.nttdata.com>
	<CALj2ACW3p_TLLH_On3Q=EWYoGKLYzi9vxH_isRXYksw5j1mkTQ@mail.gmail.com>



On 2021/01/20 17:41, Bharath Rupireddy wrote:
> On Wed, Jan 20, 2021 at 11:53 AM Fujii Masao
> <masao.fujii@oss.nttdata.com> wrote:
>> So, furthermore, we can use hash_search() to find the target cached
>> connection, instead of using hash_seq_search(), when the server name
>> is given. This would simplify the code a bit more? Of course,
>> hash_seq_search() is necessary when closing all the connections, though.
> 
> Note that the cache entry key is user mapping oid and to use
> hash_search() we need the user mapping oid. But in
> postgres_fdw_disconnect we can get server oid and we can also get user
> mapping id using GetUserMapping, but it requires
> GetUserId()/CurrentUserId as an input, I doubt we will have problems
> if CurrentUserId is changed somehow with the change of current user in
> the session. And user mapping may be dropped but still the connection
> can exist if it's in use, in that case GetUserMapping fails in cache
> lookup.
> 
> And yes, disconnecting all connections requires hash_seq_search().
> 
> Keeping above in mind, I feel we can do hash_seq_search(), as we do
> currently, even when the server name is given as input. This way, we
> don't need to bother much on the above points.
> 
> Thoughts?

Thanks for explaining this! You're right. I'd withdraw my suggestion.

Regards,


-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION





view thread (175+ messages)  latest in thread

Message-ID: <0c53c3da-9bfe-82f0-1190-5f029e92a816@oss.nttdata.com>
Permalink:  ../0c53c3da-9bfe-82f0-1190-5f029e92a816@oss.nttdata.com/
Also on:    postgresql.org/message-id/0c53c3da-9bfe-82f0-1190-5f029e92a816@oss.nttdata.com

 · 

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: masao.fujii@oss.nttdata.com, bharath.rupireddyforpostgres@gmail.com, zyu@yugabyte.com, a.kondratov@postgrespro.ru, houzj.fnst@cn.fujitsu.com
  Subject: Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit
  In-Reply-To: <0c53c3da-9bfe-82f0-1190-5f029e92a816@oss.nttdata.com>
  References: <CALj2ACVvrp5=AVp2PupEm+nAC8S4buqR3fJMmaCoc7ftT0aD2A@mail.gmail.com> <55bd82c5-d133-6fbb-f1f4-e25c1509c96e@oss.nttdata.com> <CALj2ACWqsVXK0-Mxcp05KtiUFE2HgWbdiww3uFzVZtdOUSGJ1A@mail.gmail.com> <CALj2ACXSQq4XQbpzMYSM3uKUzfqtp3Un9o_yErf1SNxHvDXg6Q@mail.gmail.com> <CALNJ-vTHJBFBVnxJ2soHhAg6UrCAD9RgMF9RF6yj5AhTuJM-mg@mail.gmail.com> <CALj2ACVEadzaB88ZRVF499nFxdO5pBTMCDJ0xG9kvLVhea0eYg@mail.gmail.com> <c2a00f21-a80d-8bce-e2ea-8cd8e16c4da9@oss.nttdata.com> <CALj2ACURjjg8wVpfb-s8GE+4ycQcx6z+QGQOM3TC_Cjz+=Lq6w@mail.gmail.com> <422884a8-c863-a4d4-cebd-562855c29977@oss.nttdata.com> <CALj2ACUv_+qaoYvsy674Aw8Myo-Ydte7b6vRKi3Q8ZmfG+S5Bg@mail.gmail.com> <0bc2b366-76d4-9480-5812-6f0de2b3f526@oss.nttdata.com> <CALj2ACXMB4Z4ewCeXWx7oOSxzkhqQ4KLeNVZ=NB6=fjhN89n3w@mail.gmail.com> <ba9c0824-77b7-16bd-e425-7b1893725eee@oss.nttdata.com> <CALj2ACW3p_TLLH_On3Q=EWYoGKLYzi9vxH_isRXYksw5j1mkTQ@mail.gmail.com> <0c53c3da-9bfe-82f0-1190-5f029e92a816@oss.nttdata.com>

* 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