mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
If we're using replication slots, we need to create them earlier
Otherwise, if the backup takes a long time, we might lose WAL we need long before we create the slot.
This commit is contained in:
committed by
Ian Barwick
parent
c93f717305
commit
882bfd9d8e
28
repmgr.c
28
repmgr.c
@@ -1399,6 +1399,20 @@ do_standby_clone(void)
|
|||||||
log_hint(_("this may take some time; consider using the -c/--fast-checkpoint option\n"));
|
log_hint(_("this may take some time; consider using the -c/--fast-checkpoint option\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If replication slots requested, create appropriate slot on
|
||||||
|
* the primary; this must be done before pg_start_backup() is
|
||||||
|
* issued, either by us or by pg_basebackup.
|
||||||
|
*/
|
||||||
|
if (options.use_replication_slots)
|
||||||
|
{
|
||||||
|
if (create_replication_slot(upstream_conn, repmgr_slot_name) == false)
|
||||||
|
{
|
||||||
|
PQfinish(upstream_conn);
|
||||||
|
exit(ERR_DB_QUERY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (runtime_options.rsync_only)
|
if (runtime_options.rsync_only)
|
||||||
{
|
{
|
||||||
PQExpBufferData tablespace_map;
|
PQExpBufferData tablespace_map;
|
||||||
@@ -1746,20 +1760,6 @@ stop_backup:
|
|||||||
/* Finally, write the recovery.conf file */
|
/* Finally, write the recovery.conf file */
|
||||||
create_recovery_file(local_data_directory);
|
create_recovery_file(local_data_directory);
|
||||||
|
|
||||||
/*
|
|
||||||
* If replication slots requested, create appropriate slot on the primary;
|
|
||||||
* create_recovery_file() will already have written `primary_slot_name` into
|
|
||||||
* `recovery.conf`
|
|
||||||
*/
|
|
||||||
if (options.use_replication_slots)
|
|
||||||
{
|
|
||||||
if (create_replication_slot(upstream_conn, repmgr_slot_name) == false)
|
|
||||||
{
|
|
||||||
PQfinish(upstream_conn);
|
|
||||||
exit(ERR_DB_QUERY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (runtime_options.rsync_only)
|
if (runtime_options.rsync_only)
|
||||||
{
|
{
|
||||||
log_notice(_("standby clone (using rsync) complete\n"));
|
log_notice(_("standby clone (using rsync) complete\n"));
|
||||||
|
|||||||
Reference in New Issue
Block a user