Re: FDW Foreign Table Access: strange LOG message

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Albrecht Dreß <albrecht(dot)dress(at)arcor(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: FDW Foreign Table Access: strange LOG message
Date: 2018-03-21 18:25:54
Message-ID: 6b34f8c0-4064-1695-8cdf-5e5469ed7ea0@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/21/2018 11:15 AM, Albrecht Dreß wrote:
> Hi Adrian & Tom:
>
> Thanks a lot for your input!
>
> Am 20.03.18 20:38 schrieb(en) Tom Lane:

See comments inline below.
>
> Unfortunately, in my original post, I confused the primary and secondary
> (accessed via the FDW) data bases in my example when I anonymised their
> identifiers…  Sorry for the confusion!  The /real/ structure is
>
>     client ---[libpq]--> my_db ---[FDW]--> ext_db
>
> and the LOG message is actually related to the “internal” connection,
> i.e. ext_db (*not* my_db) complains about “could not receive data” after
> accessing the table in ext_db through the FDW from my_db.
>
> The effect is not limited to Python, but happens with psql, too.  I.e.
> running (ext_table is the foreign table mapped into my_db, and a mapping
> exists only for user “user”)
>
> sudo -u user /usr/lib/postgresql/10/bin/psql my_db <<< "select * from
> ext_table limit 1;"
>
> *also* triggers the LOG message

Does it also happen when you open a psql session and do?:

psql>select * from ext_table limit 1;

>
> [time stamp/pid] user(at)ext_db LOG:  could not receive data from client:
> Connection reset by peer
>
>> I don't see any such log messages when testing postgres_fdw here,
>> which is odd; why are my results different?
>
> Yes, that's strange!  I have the following deb packages (from the
> stretch-pgdg repo) installed:
>
> postgresql-10            10.3-1.pgdg90+1 amd64
> postgresql-client-10     10.3-1.pgdg90+1 amd64
> postgresql-client-common 190.pgdg90+1    all
> postgresql-common        190.pgdg90+1    all
> libpq5:amd64             10.3-1.pgdg90+1 amd64

I am not seeing --contrib which is where I would expect postgres_fdw to
come from.

Is --contrib installed?

If not where is postgres_fdw coming from?

>
>> If these are about the FDW connections, maybe the answer is that
>> postgres_fdw ought to establish a backend-exit callback in which it
>> can shut down its connections gracefully.
>
> Hmm, yes, sounds like a sensible explanation.
>
>> If it's doing that now, I sure don't see where.
>
> So, if I understand you correctly, this needs to be addressed in
> postgres_fdw, and there is nothing I can fix in my setup (except for
> suppressing LOG messages) to get rid of the message?
>
> Thanks again,
> Albrecht.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-03-21 18:36:51 Foreign Key Validation after Reference Table Ownership Change
Previous Message Albrecht Dreß 2018-03-21 18:15:36 Re: FDW Foreign Table Access: strange LOG message