1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-12-11 11:41:33 +02:00

PBCKP-36: Do not write 'latest' into recovery.conf

This commit is contained in:
Arthur Zakirov 2019-04-15 11:32:09 +03:00
parent eb767ed0ad
commit fff9318401
2 changed files with 5 additions and 4 deletions

View File

@ -328,7 +328,6 @@ help_restore(void)
printf(_(" --recovery-target=immediate|latest\n"));
printf(_(" end recovery as soon as a consistent state is reached or as late as possible\n"));
printf(_(" (default: immediate)\n"));
printf(_(" --recovery-target-name=target-name\n"));
printf(_(" the named restore point to which recovery will proceed\n"));
printf(_(" --recovery-target-action=pause|promote|shutdown\n"));

View File

@ -772,10 +772,12 @@ create_recovery_conf(time_t backup_id,
char path[MAXPGPATH];
FILE *fp;
bool need_restore_conf;
bool target_latest;
target_latest = rt->target_stop != NULL &&
strcmp(rt->target_stop, "latest") == 0;
need_restore_conf = !backup->stream ||
(rt->time_string || rt->xid_string || rt->lsn_string) ||
(rt->target_stop != NULL && strcmp(rt->target_stop, "latest") == 0);
(rt->time_string || rt->xid_string || rt->lsn_string) || target_latest;
/* No need to generate recovery.conf at all. */
if (!(need_restore_conf || restore_as_replica))
@ -816,7 +818,7 @@ create_recovery_conf(time_t backup_id,
if (rt->lsn_string)
fprintf(fp, "recovery_target_lsn = '%s'\n", rt->lsn_string);
if (rt->target_stop)
if (rt->target_stop && !target_latest)
fprintf(fp, "recovery_target = '%s'\n", rt->target_stop);
if (rt->inclusive_specified)