From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Marko Tiikkaja <marko(at)joh(dot)to> |
Cc: | olivier(dot)gosseaume(at)free(dot)fr, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #13484: Performance problem with logical decoding |
Date: | 2015-07-07 11:15:03 |
Message-ID: | 20150707111503.GG30359@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-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(dot)gosseaume(at)free(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2015-07-07 11:15:30 | Re: BUG #13484: Performance problem with logical decoding |
Previous Message | Andres Freund | 2015-07-07 10:14:53 | Re: BUG #13484: Performance problem with logical decoding |