RE: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit

From: "Hou, Zhijie" <houzj(dot)fnst(at)cn(dot)fujitsu(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Zhihong Yu <zyu(at)yugabyte(dot)com>, "Alexey Kondratov" <a(dot)kondratov(at)postgrespro(dot)ru>
Subject: RE: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit
Date: 2021-01-21 06:00:49
Message-ID: c4c89e80196143e7900e0841a2a598ca@G08CNEXMBPEKD05.g08.fujitsu.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > > Attaching v15 patch set. Please consider it for further review.
> >
> > Hi
> >
> > I have some comments for the 0001 patch
> >
> > In v15-0001-postgres_fdw-function-to-discard-cached-connecti
> >
> > 1.
> > + If there is no open connection to the given foreign server,
> <literal>false</literal>
> > + is returned. If no foreign server with the given name is found,
> > + an error
> >
> > Do you think it's better add some testcases about:
> > call postgres_fdw_disconnect and postgres_fdw_disconnect_all
> > when there is no open connection to the given foreign server
>
> Do you mean a test case where foreign server exists but
> postgres_fdw_disconnect() returns false because there's no connection for
> that server?

Yes, I read this from the doc, so I think it's better to test this.

> > 2.
> > + /*
> > + * For the given server, if we closed connection
> or it is still in
> > + * use, then no need of scanning the cache
> further.
> > + */
> > + if (entry->server_hashvalue == hashvalue &&
> > + (entry->xact_depth > 0 || result))
> > + {
> > + hash_seq_term(&scan);
> > + break;
> > + }
> >
> > If I am not wrong, is the following condition always true ?
> > (entry->xact_depth > 0 || result)
>
> It's not always true. But it seems like it's too confusing, please have
> a look at the upthread suggestion to change this with can_terminate_scan
> boolean.

Thanks for the remind, I will look at that.

Best regards,
houzj

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2021-01-21 06:47:31 Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit
Previous Message Bharath Rupireddy 2021-01-21 05:52:07 Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit