Foreign table & Connection reset by peer

2019-02-23 Thread Lukáš Sobotka
Hi guys,

I would be grateful for some advice about foreign tables. I attached
simplified script describing the problem for better understanding.

What I am trying to do:

I am copying tables between two databases and for copying is used function
which are called from bash script.

What is problem:

I am creating foreign tables, selecting from them, dropping them and
everything works well. But always when I am working with them and the
session ends, message about connection resetting appears in log file of
remote database. It is showing "postgres@adam_db LOG:  could not receive
data from client: Connection reset by peer". I am calling the command
often, so this message fill my log file quite a fast. I tried to find some
info about this message, without success.
Where can be problem?

Is there some different/correct way how to use foreign tables?
How can I closed connection properly?

For reproducing you can use attached script and after that execute next
command:
*psql -c 'SELECT * FROM ft_numbers'
"postgresql://localhost:5432/bety_db?user=postgres&password=postgres"*

I also tried to drop server after selection but it also logs the message.
Command which I executed:
*psql -c 'SELECT * FROM ft_numbers; DROP SERVER adam_server CASCADE;'
"postgresql://localhost:5432/bety_db?user=postgres&password=postgres"*
I tried to replicate problem in databases with different versions - all of
them ended with the message in log. Used versions:


   - PostgreSQL 9.6.10 on x86_64-pc-linux-gnu (Ubuntu
   9.6.10-1.pgdg16.04+1), compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10)
   5.4.0 20160609, 64-bit
   - PostgreSQL 10.5 (Ubuntu 10.5-1.pgdg16.04+1) on x86_64-pc-linux-gnu,
   compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609, 64-bit
   - PostgreSQL 11.2 (Ubuntu 11.2-1.pgdg16.04+1) on x86_64-pc-linux-gnu,
   compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, 64-bit

Best regards,

Lukas


script.sql
Description: application/sql


Re: Foreign table & Connection reset by peer

2019-02-23 Thread Adrian Klaver

On 2/23/19 1:28 PM, Lukáš Sobotka wrote:

Hi guys,

I would be grateful for some advice about foreign tables. I attached 
simplified script describing the problem for better understanding.


What I am trying to do:

I am copying tables between two databases and for copying is used 
function which are called from bash script.


What is problem:

I am creating foreign tables, selecting from them, dropping them and 
everything works well. But always when I am working with them and the 
session ends, message about connection resetting appears in log file of 
remote database. It is showing "postgres@adam_db LOG:  could not receive 
data from client: Connection reset by peer". I am calling the command 
often, so this message fill my log file quite a fast. I tried to find 
some info about this message, without success.


Where can be problem?


See if the thread below applies:

https://www.postgresql.org/message-id/4004.1521759312%40sss.pgh.pa.us



Is there some different/correct way how to use foreign tables?
How can I closed connection properly?

For reproducing you can use attached script and after that execute next 
command:
/psql -c 'SELECT * FROM ft_numbers' 
"postgresql://localhost:5432/bety_db?user=postgres&password=postgres"/


I also tried to drop server after selection but it also logs the 
message. Command which I executed:/
psql -c 'SELECT * FROM ft_numbers; DROP SERVER adam_server CASCADE;' 
"postgresql://localhost:5432/bety_db?user=postgres&password=postgres"/


I tried to replicate problem in databases with different versions - all 
of them ended with the message in log.Used versions:


  * PostgreSQL 9.6.10 on x86_64-pc-linux-gnu (Ubuntu
9.6.10-1.pgdg16.04+1), compiled by gcc (Ubuntu
5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609, 64-bit
  * PostgreSQL 10.5 (Ubuntu 10.5-1.pgdg16.04+1) on x86_64-pc-linux-gnu,
compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609, 64-bit
  * PostgreSQL 11.2 (Ubuntu 11.2-1.pgdg16.04+1) on x86_64-pc-linux-gnu,
compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, 64-bit

Best regards,

Lukas




--
Adrian Klaver
adrian.kla...@aklaver.com



Re: WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2

2019-02-23 Thread Bruce Klein
Sounds good to me. Thank you!

On Fri, Feb 22, 2019 at 11:47 AM Thomas Munro 
wrote:

> On Tue, Feb 19, 2019 at 5:31 PM Thomas Munro 
> wrote:
> > On Tue, Feb 19, 2019 at 5:16 PM James Sewell 
> wrote:
> > >> Here's a starter patch that shows one of the approaches discussed.  It
> > >> gets WSL users to a better place than they were before, by suppressing
> > >> further warnings after the first one.
> > >
> > > This wasn't quite right, updated to check erro for ENOSYS (not rc)
> > >
> > > This compiles and stops the panic on WSL (with a single warning).
> > >
> > > I haven't tested if a version compiled on Linux will behave the same
> way - but based on the error messages in the top post it looks like the
> behavior is the same.
> >
> > Great.  Thanks for testing, and for the fix!  Well that all sounds
> > like good news: it corrects the behaviour from 11.2, and also improves
> > on the previous behaviour which I'd have accepted as a bug if anyone
> > had reported it.  So the next problem is that we don't have a
> > consensus on whether this is the right approach, so I don't feel like
> > I can commit it yet.  Does any want to make another concrete proposal?
>
> Ok, here's the version I'm planning to push soon if there are no
> objections.
> Re-adding Bruce to the thread, as I just noticed the CC list got
> pruned at some point in this thread.
>
> --
> Thomas Munro
> https://enterprisedb.com
>