Re: [HACKERS] pg_basebackups and slots

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: [HACKERS] pg_basebackups and slots
Дата
Msg-id CABUevEzG1HMxMOUJ5i_kLXwYDjg0EzQ6iPZHfqX0XV1O=CQb9w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] pg_basebackups and slots  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: [HACKERS] pg_basebackups and slots  (Feike Steenbergen <feikesteenbergen@gmail.com>)
Re: [HACKERS] pg_basebackups and slots  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
On Thu, Dec 15, 2016 at 10:26 AM, Magnus Hagander <magnus@hagander.net> wrote:


On Thu, Dec 15, 2016 at 10:04 AM, Magnus Hagander <magnus@hagander.net> wrote:
I've started work on a patch to make pg_basebackup use the temporary slots feature that has been committed (thanks Petr!!).  The reason for this is to avoid the cases where a burst of traffic on the master during the backup can cause the receive log part of the basebackup to fall far enough behind that it fails.

I have a few considerations at this point, about interaction with existing options.

Right now, we have -S/--slot which specifies a slot name. If you want to use that, you have to create the slot ahead of time, and it will be a permanent slot (of course). This is primarily documented as a feature to use for replication (to make sure xlog is kept around until the standby is started up), but it does also solve the same problem. But to use it for base backups today you have to manually create the slot, then base backup, then drop the slot, which is error prone.

My thought is that if -S/--slot is not specified, but -X stream is, then we use a temporary slot always. This obviously requires the server to be configured with enough slots (I still think we should change the default here, but that's a different topic), but I think that's acceptable. Then we should add a "--no-slot" to make it revert to previous behaviour. 

Does that seem reasonable? Or would people prefer it to default to off?


So here's a patch that does this, for discussion. It implements the following behavior for -X:

* When used with <10.0 servers, behave just like before.
* When -S <name> is specified, behave just like before (use an existing replication slot, fail if it does not exist)
* When used on 10.0 with no -S, create and use a temporary replication slot while running, with name pg_basebackup_<pid>.
* When used with 10.0 with no -S but --no-slot specified, run without a slot like before.

--
Вложения

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

Предыдущее
От: Petr Jelinek
Дата:
Сообщение: Re: [HACKERS] Logical Replication WIP
Следующее
От: Vladimir Rusinov
Дата:
Сообщение: Re: [HACKERS] [PATCH] Rename pg_switch_xlog to pg_switch_wal