@@ -511,14 +511,18 @@ catchup_multithreaded_copy(int num_threads,
511511 threads = (pthread_t * ) palloc (sizeof (pthread_t ) * num_threads );
512512 for (i = 0 ; i < num_threads ; i ++ )
513513 {
514- elog (VERBOSE , "Start thread num: %i" , i );
515- pthread_create (& threads [i ], NULL , & catchup_thread_runner , & (threads_args [i ]));
514+ if (!dry_run )
515+ {
516+ elog (VERBOSE , "Start thread num: %i" , i );
517+ pthread_create (& threads [i ], NULL , & catchup_thread_runner , & (threads_args [i ]));
518+ }
516519 }
517520
518521 /* Wait threads */
519522 for (i = 0 ; i < num_threads ; i ++ )
520523 {
521- pthread_join (threads [i ], NULL );
524+ if (!dry_run )
525+ pthread_join (threads [i ], NULL );
522526 all_threads_successful &= threads_args [i ].completed ;
523527 transfered_bytes_result += threads_args [i ].transfered_bytes ;
524528 }
@@ -714,6 +718,8 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
714718 start_WAL_streaming (source_conn , dest_xlog_path , & instance_config .conn_opt ,
715719 current .start_lsn , current .tli , false);
716720 }
721+ else
722+ elog (INFO , "WAL streaming cannot be started with --dry-run option" );
717723
718724 source_filelist = parray_new ();
719725
@@ -784,9 +790,9 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
784790
785791 /* Build the page map from ptrack information */
786792 make_pagemap_from_ptrack_2 (source_filelist , source_conn ,
787- source_node_info .ptrack_schema ,
788- source_node_info .ptrack_version_num ,
789- dest_redo .lsn );
793+ source_node_info .ptrack_schema ,
794+ source_node_info .ptrack_version_num ,
795+ dest_redo .lsn );
790796 time (& end_time );
791797 elog (INFO , "Pagemap successfully extracted, time elapsed: %.0f sec" ,
792798 difftime (end_time , start_time ));
@@ -909,7 +915,7 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
909915 */
910916 if (current .backup_mode != BACKUP_MODE_FULL )
911917 {
912- elog (INFO , "Redundant files %s in destination directory" , dry_run ? "can" : "will" );
918+ elog (INFO , "Redundant files in destination directory %s be removed " , dry_run ? "can" : "will" );
913919 parray_qsort (dest_filelist , pgFileCompareRelPathWithExternalDesc );
914920 for (i = 0 ; i < parray_num (dest_filelist ); i ++ )
915921 {
@@ -945,8 +951,7 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
945951 }
946952
947953 /* shrink dest pgdata list */
948- if (!dry_run )
949- pgFileFree (file );
954+ pgFileFree (file );
950955 parray_remove (dest_filelist , i );
951956 i -- ;
952957 }
@@ -963,17 +968,14 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
963968 if (dest_filelist )
964969 parray_qsort (dest_filelist , pgFileCompareRelPathWithExternal );
965970
966- if (!dry_run )
967- {
968- /* run copy threads */
969- elog (INFO , "Start transferring data files" );
970- time (& start_time );
971- transfered_datafiles_bytes = catchup_multithreaded_copy (num_threads , & source_node_info ,
972- source_pgdata , dest_pgdata ,
973- source_filelist , dest_filelist ,
974- dest_redo .lsn , current .backup_mode );
975- catchup_isok = transfered_datafiles_bytes != -1 ;
976- }
971+ /* run copy threads */
972+ elog (INFO , "Transferring data files %s started" , dry_run ? "can be" : "" );
973+ time (& start_time );
974+ transfered_datafiles_bytes = catchup_multithreaded_copy (num_threads , & source_node_info ,
975+ source_pgdata , dest_pgdata ,
976+ source_filelist , dest_filelist ,
977+ dest_redo .lsn , current .backup_mode );
978+ catchup_isok = transfered_datafiles_bytes != -1 ;
977979
978980 /* at last copy control file */
979981 if (catchup_isok && !dry_run )
@@ -1101,7 +1103,7 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
11011103 pretty_size (transfered_datafiles_bytes , pretty_transfered_data_bytes , lengthof (pretty_transfered_data_bytes ));
11021104 pretty_size (transfered_walfiles_bytes , pretty_transfered_wal_bytes , lengthof (pretty_transfered_wal_bytes ));
11031105
1104- elog (INFO , "Databases %s synchronized. Transfered datafiles size : %s, transfered wal size: %s, time elapsed: %s" ,
1106+ elog (INFO , "Databases %s synchronized. Transfered datafiles sizes : %s, transfered wal size: %s, time elapsed: %s" ,
11051107 dry_run ? "can be" : "was" ,
11061108 pretty_transfered_data_bytes , pretty_transfered_wal_bytes , pretty_time );
11071109
@@ -1112,14 +1114,10 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
11121114 }
11131115
11141116 /* Sync all copied files unless '--no-sync' flag is used */
1115- if (!dry_run )
1116- {
1117- /* Sync all copied files unless '--no-sync' flag is used */
1118- if (sync_dest_files )
1119- catchup_sync_destination_files (dest_pgdata , FIO_LOCAL_HOST , source_filelist , source_pg_control_file );
1120- else
1121- elog (WARNING , "Files are not synced to disk" );
1122- }
1117+ if (sync_dest_files && !dry_run )
1118+ catchup_sync_destination_files (dest_pgdata , FIO_LOCAL_HOST , source_filelist , source_pg_control_file );
1119+ else
1120+ elog (WARNING , "Files are not synced to disk" );
11231121
11241122 /* Cleanup */
11251123 if (dest_filelist && !dry_run )
0 commit comments