Re: Including replication slot data in base backups - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: Including replication slot data in base backups
Date
Msg-id CABUevEyta_M=TUw2NM7Y5hgNjQ6fNvPRUFCQhyGcBFYyghD9+w@mail.gmail.com
Whole thread Raw
In response to Including replication slot data in base backups  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: Including replication slot data in base backups
Re: Including replication slot data in base backups
List pgsql-hackers
On Tue, Apr 1, 2014 at 2:24 PM, Michael Paquier <michael.paquier@gmail.com> wrote:
Hi all,

As of now, pg_basebackup creates an empty repository for pg_replslot/
in a base backup, forcing the user to recreate slots on other nodes of
the cluster with pg_create_*_replication_slot, or copy pg_replslot
from another node. This is not really user-friendly especially after a
failover where a given slave may not have the replication slot
information of the master that it is replacing.

The simple patch attached adds a new option in pg_basebackup, called
--replication-slot, allowing to include replication slot information
in a base backup. This is done by extending the command BASE_BACKUP in
the replication protocol.

--replication-slots would be a better name (plural), or probably --include-replication-slots. (and that comment also goes for the BASE_BACKUP syntax and variables)


But. If you want to solve the failover case, doesn't that mean you need to include it in the *replication* stream and not just the base backup? Otherwise, what you're sending over might well be out of date set of slots once the failover happens? What if the set of replication slots change between the time of the basebackup and the failover?

As it is too late for 9.4, I would like to add it to the first commit
fest of 9.5. Comments are welcome.

It's not too late to fix omissions in 9.4 features though, if we consider it that. Which I think this could probably be considered as - if we think the solution is the right one. 


--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: pg_stat_statements cluttered with "DEALLOCATE dbdpg_p*"
Next
From: Andrew Dunstan
Date:
Subject: Re: pg_stat_statements cluttered with "DEALLOCATE dbdpg_p*"