@@ -23,7 +23,6 @@ typedef struct
23
23
pgBackup * backup ;
24
24
}restore_files_args ;
25
25
26
- static void backup_online_files (bool re_recovery );
27
26
static void restore_database (pgBackup * backup );
28
27
static void create_recovery_conf (const char * target_time ,
29
28
const char * target_xid ,
@@ -104,9 +103,6 @@ do_restore(const char *target_time,
104
103
elog (LOG ,"latest full backup timeline ID = %u" ,backup_tli );
105
104
elog (LOG ,"target timeline ID = %u" ,target_tli );
106
105
107
- /* backup online WAL */
108
- backup_online_files (cur_tli != 0 && cur_tli != backup_tli );
109
-
110
106
/*
111
107
* Clear restore destination, but don't remove $PGDATA.
112
108
* To remove symbolic link, get file list with "omit_symlink = false".
@@ -181,26 +177,22 @@ do_restore(const char *target_time,
181
177
!satisfy_recovery_target (backup ,rt ))
182
178
continue ;
183
179
184
- print_backup_lsn ( backup ) ;
180
+ stream_wal = backup -> stream ;
185
181
182
+ print_backup_lsn (backup );
186
183
restore_database (backup );
187
184
last_restored_index = i ;
188
185
}
189
186
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..." );
198
191
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 );
201
193
202
- elog (LOG ,"all necessary files are found" );
203
- }
194
+ elog (LOG ,"all necessary files are found" );
195
+ }
204
196
205
197
/* create recovery.conf */
206
198
if (!stream_wal )
@@ -481,47 +473,6 @@ create_recovery_conf(const char *target_time,
481
473
}
482
474
}
483
475
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
-
525
476
/*
526
477
* Try to read a timeline's history file.
527
478
*