Drop a previously created replication slot if base backup fails for any reason

Per Github #129
This commit is contained in:
Ian Barwick
2015-11-30 12:38:51 +09:00
parent 77d52adb53
commit 62d53b7622

View File

@@ -1785,9 +1785,16 @@ stop_backup:
/* If the backup failed then exit */
if (r != 0)
{
/* If a replication slot was previously created, drop it */
if (options.use_replication_slots)
{
drop_replication_slot(upstream_conn, repmgr_slot_name);
}
log_err(_("unable to take a base backup of the master server\n"));
log_warning(_("destination directory (%s) may need to be cleaned up manually\n"),
local_data_directory);
PQfinish(upstream_conn);
exit(retval);
}