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-18 06:02:29
Message-ID: e7ddd14e96444fce88e47a709c196537@G08CNEXMBPEKD05.g08.fujitsu.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> We need to create the loopback3 with user mapping public, otherwise the
> test might become unstable as shown below. Note that loopback and
> loopback2 are not dropped in the test, so no problem with them.
>
> ALTER SERVER loopback OPTIONS (ADD use_remote_estimate 'off'); DROP
> SERVER loopback3 CASCADE;
> NOTICE: drop cascades to 2 other objects
> -DETAIL: drop cascades to user mapping for postgres on server loopback3
> +DETAIL: drop cascades to user mapping for bharath on server loopback3
>
> Attaching v2 patch for postgres_fdw_get_connections. Please have a look.
Hi

I have a comment for the doc about postgres_fdw_get_connections.

+ <term><function>postgres_fdw_get_connections(OUT server_name text, OUT valid boolean) returns setof record</function></term>
+ <listitem>
+ <para>
+ This function returns the foreign server names of all the open
+ connections that <filename>postgres_fdw</filename> established from
+ the local session to the foreign servers. It also returns whether
+ each connection is valid or not. <literal>false</literal> is returned
+ if the foreign server connection is used in the current local
+ transaction but its foreign server or user mapping is changed or
+ dropped, and then such invalid connection will be closed at
+ the end of that transaction. <literal>true</literal> is returned
+ otherwise. If there are no open connections, no record is returned.
+ Example usage of the function:

The doc seems does not memtion the case when the function returns NULL in server_name.
Users may be a little confused about why NULL was returned.

Best regards,
houzj

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-01-18 06:08:38 Re: Wrong usage of RelationNeedsWAL
Previous Message Dilip Kumar 2021-01-18 05:56:00 Re: Is Recovery actually paused?