pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Marko Tiikkaja <marko@joh.to>
Cc: olivier.gosseaume@free.fr
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13484: Performance problem with logical decoding
Date: Tue, 7 Jul 2015 13:15:03 +0200
Message-ID: <20150707111503.GG30359@alap3.anarazel.de> (raw)
In-Reply-To: <559AF98B.3050901@joh.to>
References: <DAE4FF93-DB6B-439A-A287-4CCB5068599A@anarazel.de>
	<1218457515.16345590.1436203770840.JavaMail.root@zimbra72-e12.priv.proxad.net>
	<20150706204138.GC340@alap3.anarazel.de>
	<559AF98B.3050901@joh.to>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi Olivier, Marko,

On 2015-07-07 00:56:27 +0300, Marko Tiikkaja wrote:
> On 2015-07-06 23:41, Andres Freund wrote:
> >On 2015-07-06 19:29:30 +0200, olivier.gosseaume@free.fr wrote:
> >>BTW there is also a bug in pg_recvlogical with option -f - (output to
> >>stdout), pg_recvlogical tries to flush with fsync which does not work
> >>on windows and display an error message.
> >
> >Uh, that should obviously not be the case. Thanks for the report, will
> >fix.
>
> Same problem on at least OS X, if stdout is piped to e.g. hexdump.

Interesting - I apparently forsaw that case and decided to handle it by
not erroring out on EINVAL:

    /* Accept EINVAL, in case output is writing to a pipe or similar. */
    if (fsync(outfd) != 0 && errno != EINVAL)
    {
        fprintf(stderr,
                _("%s: could not fsync log file \"%s\": %s\n"),
                progname, outfile, strerror(errno));
        return false;
    }

but that's obviously not good enough.

I think testing whether the output fd is a regular file and not a tty
when opening it should work across platforms:

    if (fstat(outfd, &statbuf) != 0)
        fprintf(stderr,
                _("%s: could not stat file \"%s\": %s\n"),
                progname, outfile, strerror(errno));

    output_isfile = S_ISREG(statbuf.st_mode) && !isatty(outfd);

I pushed the patch and tested it locally (linux), but I'd be thankful if
you two could test whether it works now on your respective platforms.

Regards,

Andres


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (19+ messages)  latest in thread

Message-ID: <20150707111503.GG30359@alap3.anarazel.de>
Permalink:  ../20150707111503.GG30359@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20150707111503.GG30359@alap3.anarazel.de

 · 

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-bugs@postgresql.org
  Cc: andres@anarazel.de, marko@joh.to, olivier.gosseaume@free.fr
  Subject: Re: BUG #13484: Performance problem with logical decoding
  In-Reply-To: <20150707111503.GG30359@alap3.anarazel.de>
  References: <DAE4FF93-DB6B-439A-A287-4CCB5068599A@anarazel.de> <1218457515.16345590.1436203770840.JavaMail.root@zimbra72-e12.priv.proxad.net> <20150706204138.GC340@alap3.anarazel.de> <559AF98B.3050901@joh.to> <20150707111503.GG30359@alap3.anarazel.de>

* 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