Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit faae297

Browse files
author
Artur Zakirov
committed
Do not create recovery.conf only if backup-ID was passed and only if destination backup is not stream backup
1 parent 733cf37 commit faae297

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

pg_probackup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <time.h>
1717
#include <sys/stat.h>
1818

19-
const char *PROGRAM_VERSION = "1.0.1";
19+
const char *PROGRAM_VERSION = "1.0.2";
2020
const char *PROGRAM_URL = "https://github.com/postgrespro/pg_probackup";
2121
const char *PROGRAM_EMAIL = "https://github.com/postgrespro/pg_probackup/issues";
2222

restore.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ do_restore(time_t backup_id,
9191
pgBackup *base_backup = NULL;
9292
pgBackup *dest_backup = NULL;
9393
pgRecoveryTarget *rt = NULL;
94-
bool need_recovery_conf = false;
94+
bool need_recovery_conf = true;
9595

9696
/* PGDATA and ARCLOG_PATH are always required */
9797
if (pgdata == NULL)
@@ -200,16 +200,16 @@ do_restore(time_t backup_id,
200200
/* Tablespace directories checking */
201201
check_tablespace_mapping((pgBackup *) parray_get(backups, last_diff_index));
202202

203+
if (dest_backup && dest_backup->stream)
204+
need_recovery_conf = target_time != NULL || target_xid != NULL;
205+
203206
/* Restore backups from base_index to last_diff_index */
204-
need_recovery_conf = target_time != NULL || target_xid != NULL;
205207
for (i = base_index; i >= last_diff_index; i--)
206208
{
207209
pgBackup *backup = (pgBackup *) parray_get(backups, i);
208210

209211
if (backup->status == BACKUP_STATUS_OK)
210212
{
211-
need_recovery_conf = need_recovery_conf || !backup->stream;
212-
213213
print_backup_lsn(backup);
214214
restore_database(backup);
215215
}

tests/expected/option_version.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pg_probackup 1.0
1+
pg_probackup 1.0.2

validate.c

+4-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ do_validate(time_t backup_id,
3939
pgBackup *base_backup = NULL;
4040
pgBackup *dest_backup = NULL;
4141
bool success_validate,
42-
need_validate_wal = false;
42+
need_validate_wal = true;
4343

4444
catalog_lock(false);
4545

@@ -128,20 +128,18 @@ do_validate(time_t backup_id,
128128

129129
Assert(last_diff_index <= base_index);
130130

131+
if (dest_backup && dest_backup->stream)
132+
need_validate_wal = target_time != NULL || target_xid != NULL;
133+
131134
/* Validate backups from base_index to last_diff_index */
132-
need_validate_wal = target_time != NULL || target_xid != NULL;
133135
for (i = base_index; i >= last_diff_index; i--)
134136
{
135137
pgBackup *backup = (pgBackup *) parray_get(backups, i);
136138

137139
if (backup->status == BACKUP_STATUS_OK ||
138140
backup->status == BACKUP_STATUS_CORRUPT)
139-
{
140-
need_validate_wal = need_validate_wal || !backup->stream;
141-
142141
success_validate = pgBackupValidate(backup, false, false) &&
143142
success_validate;
144-
}
145143
}
146144

147145
/* and now we must check WALs */

0 commit comments

Comments
 (0)