Only execute pg_stop_backup() if pg_start_backup() was previously executed

It's not a problem per-se but produces some unnecessary and possibly
confusing errors.
This commit is contained in:
Ian Barwick
2015-03-19 23:19:34 +09:00
parent 1b4a8917ca
commit ae19c9bd5d

View File

@@ -915,6 +915,7 @@ do_standby_clone(void)
retval = SUCCESS;
int i;
bool pg_start_backup_executed = false;
bool target_directory_provided = false;
bool config_file_copy_required = false;
@@ -1175,6 +1176,13 @@ do_standby_clone(void)
goto stop_backup;
}
/*
* Note that we've successfully executed pg_start_backup(),
* so we know whether or not to execute pg_stop_backup() after
* the 'stop_backup' label
*/
pg_start_backup_executed = true;
/*
* 1. copy data directory, omitting directories which should not be
* copied, or for which copying would serve no purpose.
@@ -1423,7 +1431,7 @@ do_standby_clone(void)
stop_backup:
if(runtime_options.rsync_only)
if(runtime_options.rsync_only && pg_start_backup_executed)
{
log_notice(_("notifying master about backup completion...\n"));
if(stop_backup(upstream_conn, last_wal_segment) == false)