@@ -23,7 +23,6 @@ typedef struct
2323pgBackup * backup ;
2424}restore_files_args ;
2525
26- static void backup_online_files (bool re_recovery );
2726static void restore_database (pgBackup * backup );
2827static void create_recovery_conf (const char * target_time ,
2928const char * target_xid ,
@@ -104,9 +103,6 @@ do_restore(const char *target_time,
104103elog (LOG ,"latest full backup timeline ID = %u" ,backup_tli );
105104elog (LOG ,"target timeline ID = %u" ,target_tli );
106105
107- /* backup online WAL */
108- backup_online_files (cur_tli != 0 && cur_tli != backup_tli );
109-
110106/*
111107 * Clear restore destination, but don't remove $PGDATA.
112108 * To remove symbolic link, get file list with "omit_symlink = false".
@@ -181,26 +177,22 @@ do_restore(const char *target_time,
181177!satisfy_recovery_target (backup ,rt ))
182178continue ;
183179
184- print_backup_lsn ( backup ) ;
180+ stream_wal = backup -> stream ;
185181
182+ print_backup_lsn (backup );
186183restore_database (backup );
187184last_restored_index = i ;
188185}
189186
190- for (i = last_restored_index ;i >=0 ;i -- )
191- {
192- char xlogpath [MAXPGPATH ];
193- elog (LOG ,"searching archived WAL..." );
194-
195- search_next_wal (arclog_path ,& need_lsn ,timelines );
196-
197- elog (LOG ,"searching online WAL..." );
187+ if (!stream_wal )
188+ for (i = last_restored_index ;i >=0 ;i -- )
189+ {
190+ elog (LOG ,"searching archived WAL..." );
198191
199- join_path_components (xlogpath ,pgdata ,PG_XLOG_DIR );
200- search_next_wal (xlogpath ,& need_lsn ,timelines );
192+ search_next_wal (arclog_path ,& need_lsn ,timelines );
201193
202- elog (LOG ,"all necessary files are found" );
203- }
194+ elog (LOG ,"all necessary files are found" );
195+ }
204196
205197/* create recovery.conf */
206198if (!stream_wal )
@@ -481,47 +473,6 @@ create_recovery_conf(const char *target_time,
481473}
482474}
483475
484- static void
485- backup_online_files (bool re_recovery )
486- {
487- char work_path [MAXPGPATH ];
488- char pg_xlog_path [MAXPGPATH ];
489- bool files_exist ;
490- parray * files ;
491-
492- if (!check )
493- {
494- elog (LOG ,"----------------------------------------" );
495- elog (LOG ,"backup online WAL start" );
496- }
497-
498- /* get list of files in $BACKUP_PATH/backup/pg_xlog */
499- files = parray_new ();
500- snprintf (work_path ,lengthof (work_path ),"%s/%s/%s" ,backup_path ,
501- RESTORE_WORK_DIR ,PG_XLOG_DIR );
502- dir_list_file (files ,work_path ,NULL , true, false);
503-
504- files_exist = parray_num (files )> 0 ;
505-
506- parray_walk (files ,pgFileFree );
507- parray_free (files );
508-
509- /* If files exist in RESTORE_WORK_DIR and not re-recovery, use them. */
510- if (files_exist && !re_recovery )
511- {
512- elog (LOG ,"online WALs have been already backed up, use them" );
513- return ;
514- }
515-
516- /* backup online WAL */
517- snprintf (pg_xlog_path ,lengthof (pg_xlog_path ),"%s/pg_xlog" ,pgdata );
518- snprintf (work_path ,lengthof (work_path ),"%s/%s/%s" ,backup_path ,
519- RESTORE_WORK_DIR ,PG_XLOG_DIR );
520- dir_create_dir (work_path ,DIR_PERMISSION );
521- dir_copy_files (pg_xlog_path ,work_path );
522- }
523-
524-
525476/*
526477 * Try to read a timeline's history file.
527478 *