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

bugfix: explicitly forbid incremental backing up instance from the past

This commit is contained in:
Grigory Smolkin 2019-04-11 19:14:33 +03:00
parent 06add7d59f
commit 6d8bad7293

View File

@ -582,6 +582,15 @@ do_backup_instance(void)
strlen(" with pg_probackup"));
pg_start_backup(label, smooth_checkpoint, &current);
/* For incremental backup check that start_lsn is not from the past */
if (current.backup_mode != BACKUP_MODE_FULL &&
prev_backup->start_lsn > current.start_lsn)
elog(ERROR, "Current START LSN %X/%X is lower than START LSN %X/%X of previous backup %s. "
"It may indicate that we are trying to backup PostgreSQL instance from the past.",
(uint32) (current.start_lsn >> 32), (uint32) (current.start_lsn),
(uint32) (prev_backup->start_lsn >> 32), (uint32) (prev_backup->start_lsn),
base36enc(prev_backup->start_time));
/* Update running backup meta with START LSN */
write_backup(&current);