Re: pg_xlogdump follow into the future

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pg_xlogdump follow into the future
Дата
Msg-id 20160714182720.elclzcedr4v7qe3b@alap3.anarazel.de
обсуждение исходный текст
Ответ на pg_xlogdump follow into the future  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: pg_xlogdump follow into the future  (Magnus Hagander <magnus@hagander.net>)
Список pgsql-hackers
On 2016-07-14 13:46:23 +0200, Magnus Hagander wrote:
> Currently, if you run pg_xlogdump with -f, you have to specify an end
> position in an existing file, or if you don't it will only follow until the
> end of the current file.

That's because specifying a file explicitly says that you only want to
look at that file, specifying two files that you want the range
inclusively between the two files.  -f works if you just use -s.


> I'd appreciate a review of that by someone who's done more work on the xlog
> stuff, but it seems trivial to me. Not sure I can argue it's a bugfix
> though, since the usecase simply did not work...

I'd say it's working as intended, and you want to change that
intent. That's fair, but I'd not call it a bug, and I'd say it's not
really 9.6 material.

> diff --git a/src/bin/pg_xlogdump/pg_xlogdump.c b/src/bin/pg_xlogdump/pg_xlogdump.c
> index c0a6816..2f1018b 100644
> --- a/src/bin/pg_xlogdump/pg_xlogdump.c
> +++ b/src/bin/pg_xlogdump/pg_xlogdump.c
> @@ -901,8 +901,14 @@ main(int argc, char **argv)
>              goto bad_argument;
>          }
>  
> -        /* no second file specified, set end position */
> -        if (!(optind + 1 < argc) && XLogRecPtrIsInvalid(private.endptr))
> +        /*
> +         * No second file specified, so unless we are in follow mode,
> +         * set the end position to the end of the same segment as
> +         * the start position.
> +         */
> +        if (!(optind + 1 < argc) &&
> +            XLogRecPtrIsInvalid(private.endptr) &&
> +            !config.follow)
>              XLogSegNoOffsetToRecPtr(segno + 1, 0, private.endptr);
>  
>          /* parse ENDSEG if passed */
> @@ -933,7 +939,8 @@ main(int argc, char **argv)
>          }
>  
>  
> -        if (!XLByteInSeg(private.endptr, segno) &&
> +        if (!XLogRecPtrIsInvalid(private.endptr) &&
> +            !XLByteInSeg(private.endptr, segno) &&
>              private.endptr != (segno + 1) * XLogSegSize)
>          {
>              fprintf(stderr,

Other than that it looks reasonable from a quick glance.

Andres



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Issue in pg_catalog.pg_indexes view definition
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Reviewing freeze map code