1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-02-13 14:58:35 +02:00

[Issue #289] Wait for Start LSN after finding the suitable parent backup, not before

This commit is contained in:
Grigory Smolkin 2021-01-20 15:39:38 +03:00
parent 286d30dbff
commit e7ffc15417

View File

@ -146,15 +146,6 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync, bool
current.tli = get_current_timeline_from_control(false);
#endif
/* In PAGE mode or in ARCHIVE wal-mode wait for current segment */
if (current.backup_mode == BACKUP_MODE_DIFF_PAGE ||!stream_wal)
/*
* Do not wait start_lsn for stream backup.
* Because WAL streaming will start after pg_start_backup() in stream
* mode.
*/
wait_wal_lsn(current.start_lsn, true, current.tli, false, true, ERROR, false);
/*
* In incremental backup mode ensure that already-validated
* backup on current timeline exists and get its filelist.
@ -264,10 +255,14 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync, bool
/* Update running backup meta with START LSN */
write_backup(&current, true);
join_path_components(external_prefix, current.database_dir, EXTERNAL_DIR);
/* initialize backup's file list */
backup_files_list = parray_new();
/* In PAGE mode or in ARCHIVE wal-mode wait for current segment */
if (current.backup_mode == BACKUP_MODE_DIFF_PAGE || !stream_wal)
/*
* Do not wait start_lsn for stream backup.
* Because WAL streaming will start after pg_start_backup() in stream
* mode.
*/
wait_wal_lsn(current.start_lsn, true, current.tli, false, true, ERROR, false);
/* start stream replication */
if (stream_wal)
@ -279,6 +274,10 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync, bool
current.start_lsn, current.tli);
}
/* initialize backup's file list */
backup_files_list = parray_new();
join_path_components(external_prefix, current.database_dir, EXTERNAL_DIR);
/* list files with the logical path. omit $PGDATA */
if (fio_is_remote(FIO_DB_HOST))
fio_list_dir(backup_files_list, instance_config.pgdata,