From faae29739eeb1adee0546cd969d86973599ba30c Mon Sep 17 00:00:00 2001 From: Artur Zakirov Date: Fri, 3 Mar 2017 17:06:36 +0300 Subject: [PATCH] Do not create recovery.conf only if backup-ID was passed and only if destination backup is not stream backup --- pg_probackup.c | 2 +- restore.c | 8 ++++---- tests/expected/option_version.out | 2 +- validate.c | 10 ++++------ 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/pg_probackup.c b/pg_probackup.c index 50f3dff0..4772cd77 100644 --- a/pg_probackup.c +++ b/pg_probackup.c @@ -16,7 +16,7 @@ #include #include -const char *PROGRAM_VERSION = "1.0.1"; +const char *PROGRAM_VERSION = "1.0.2"; const char *PROGRAM_URL = "https://github.com/postgrespro/pg_probackup"; const char *PROGRAM_EMAIL = "https://github.com/postgrespro/pg_probackup/issues"; diff --git a/restore.c b/restore.c index bac69b49..2448ef67 100644 --- a/restore.c +++ b/restore.c @@ -91,7 +91,7 @@ do_restore(time_t backup_id, pgBackup *base_backup = NULL; pgBackup *dest_backup = NULL; pgRecoveryTarget *rt = NULL; - bool need_recovery_conf = false; + bool need_recovery_conf = true; /* PGDATA and ARCLOG_PATH are always required */ if (pgdata == NULL) @@ -200,16 +200,16 @@ base_backup_found: /* Tablespace directories checking */ check_tablespace_mapping((pgBackup *) parray_get(backups, last_diff_index)); + if (dest_backup && dest_backup->stream) + need_recovery_conf = target_time != NULL || target_xid != NULL; + /* Restore backups from base_index to last_diff_index */ - need_recovery_conf = target_time != NULL || target_xid != NULL; for (i = base_index; i >= last_diff_index; i--) { pgBackup *backup = (pgBackup *) parray_get(backups, i); if (backup->status == BACKUP_STATUS_OK) { - need_recovery_conf = need_recovery_conf || !backup->stream; - print_backup_lsn(backup); restore_database(backup); } diff --git a/tests/expected/option_version.out b/tests/expected/option_version.out index f69567ab..a41ccd37 100644 --- a/tests/expected/option_version.out +++ b/tests/expected/option_version.out @@ -1 +1 @@ -pg_probackup 1.0 +pg_probackup 1.0.2 diff --git a/validate.c b/validate.c index 457c3073..e8e505d8 100644 --- a/validate.c +++ b/validate.c @@ -39,7 +39,7 @@ do_validate(time_t backup_id, pgBackup *base_backup = NULL; pgBackup *dest_backup = NULL; bool success_validate, - need_validate_wal = false; + need_validate_wal = true; catalog_lock(false); @@ -128,20 +128,18 @@ base_backup_found: Assert(last_diff_index <= base_index); + if (dest_backup && dest_backup->stream) + need_validate_wal = target_time != NULL || target_xid != NULL; + /* Validate backups from base_index to last_diff_index */ - need_validate_wal = target_time != NULL || target_xid != NULL; for (i = base_index; i >= last_diff_index; i--) { pgBackup *backup = (pgBackup *) parray_get(backups, i); if (backup->status == BACKUP_STATUS_OK || backup->status == BACKUP_STATUS_CORRUPT) - { - need_validate_wal = need_validate_wal || !backup->stream; - success_validate = pgBackupValidate(backup, false, false) && success_validate; - } } /* and now we must check WALs */