@@ -344,6 +344,9 @@ do_backup_instance(PGconn *backup_conn)
344
344
dir_list_file (backup_files_list , parray_get (external_dirs , i ),
345
345
false, true, false, i + 1 , FIO_DB_HOST );
346
346
347
+ /* close ssh session in main thread */
348
+ fio_disconnect ();
349
+
347
350
/* Sanity check for backup_files_list, thank you, Windows:
348
351
* https://github.com/postgrespro/pg_probackup/issues/48
349
352
*/
@@ -512,6 +515,9 @@ do_backup_instance(PGconn *backup_conn)
512
515
parray_free (prev_backup_filelist );
513
516
}
514
517
518
+ /* Notify end of backup */
519
+ pg_stop_backup (& current , pg_startbackup_conn );
520
+
515
521
/* In case of backup from replica >= 9.6 we must fix minRecPoint,
516
522
* First we must find pg_control in backup_files_list.
517
523
*/
@@ -532,16 +538,16 @@ do_backup_instance(PGconn *backup_conn)
532
538
break ;
533
539
}
534
540
}
535
- }
536
-
537
- /* ssh connection to longer needed */
538
- fio_disconnect ();
539
541
540
- /* Notify end of backup */
541
- pg_stop_backup (& current , pg_startbackup_conn );
542
+ if (!pg_control )
543
+ elog (ERROR , "Failed to find file \"%s\" in backup filelist." ,
544
+ pg_control_path );
542
545
543
- if (current .from_replica && !exclusive_backup )
544
546
set_min_recovery_point (pg_control , database_path , current .stop_lsn );
547
+ }
548
+
549
+ /* close ssh session in main thread */
550
+ fio_disconnect ();
545
551
546
552
/* Add archived xlog files into the list of files of this backup */
547
553
if (stream_wal )
@@ -683,9 +689,6 @@ do_backup(time_t start_time, bool no_validate)
683
689
*/
684
690
check_system_identifiers (backup_conn , instance_config .pgdata );
685
691
686
- /* ssh connection to longer needed */
687
- fio_disconnect ();
688
-
689
692
/* below perform checks specific for backup command */
690
693
#if PG_VERSION_NUM >= 110000
691
694
if (!RetrieveWalSegSize (backup_conn ))
0 commit comments