Re: BUG #13484: Performance problem with logical decoding

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: BUG #13484: Performance problem with logical decoding
Дата
Msg-id 20150707111503.GG30359@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: BUG #13484: Performance problem with logical decoding  (Marko Tiikkaja <marko@joh.to>)
Ответы Re: BUG #13484: Performance problem with logical decoding  (Marko Tiikkaja <marko@joh.to>)
Re: BUG #13484: Performance problem with logical decoding  (olivier.gosseaume@free.fr)
Список 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.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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: BUG #13484: Performance problem with logical decoding
Следующее
От: Andres Freund
Дата:
Сообщение: Re: BUG #13484: Performance problem with logical decoding