1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-07 13:40:17 +02:00

minor bugfix: close ssh connection when it is not needed anymore

This commit is contained in:
Grigory Smolkin 2019-07-03 18:09:00 +03:00
parent b231d845f3
commit e1880c57c6

View File

@ -344,6 +344,9 @@ do_backup_instance(PGconn *backup_conn)
dir_list_file(backup_files_list, parray_get(external_dirs, i),
false, true, false, i+1, FIO_DB_HOST);
/* close ssh session in main thread */
fio_disconnect();
/* Sanity check for backup_files_list, thank you, Windows:
* https://github.com/postgrespro/pg_probackup/issues/48
*/
@ -512,6 +515,9 @@ do_backup_instance(PGconn *backup_conn)
parray_free(prev_backup_filelist);
}
/* Notify end of backup */
pg_stop_backup(&current, pg_startbackup_conn);
/* In case of backup from replica >= 9.6 we must fix minRecPoint,
* First we must find pg_control in backup_files_list.
*/
@ -532,17 +538,17 @@ do_backup_instance(PGconn *backup_conn)
break;
}
}
if (!pg_control)
elog(ERROR, "Failed to find file \"%s\" in backup filelist.",
pg_control_path);
set_min_recovery_point(pg_control, database_path, current.stop_lsn);
}
/* ssh connection to longer needed */
/* close ssh session in main thread */
fio_disconnect();
/* Notify end of backup */
pg_stop_backup(&current, pg_startbackup_conn);
if (current.from_replica && !exclusive_backup)
set_min_recovery_point(pg_control, database_path, current.stop_lsn);
/* Add archived xlog files into the list of files of this backup */
if (stream_wal)
{
@ -683,9 +689,6 @@ do_backup(time_t start_time, bool no_validate)
*/
check_system_identifiers(backup_conn, instance_config.pgdata);
/* ssh connection to longer needed */
fio_disconnect();
/* below perform checks specific for backup command */
#if PG_VERSION_NUM >= 110000
if (!RetrieveWalSegSize(backup_conn))