mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-01-23 11:45:36 +02:00
Try make stream replication right.
This commit is contained in:
parent
b6ceb7ff2e
commit
65bb8b5902
15
backup.c
15
backup.c
@ -151,6 +151,11 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
|
||||
if (current.backup_mode != BACKUP_MODE_DIFF_PTRACK && !disable_ptrack_clear)
|
||||
pg_ptrack_clear();
|
||||
|
||||
/* notify start of backup to PostgreSQL server */
|
||||
time2iso(label, lengthof(label), current.start_time);
|
||||
strncat(label, " with pg_arman", lengthof(label));
|
||||
pg_start_backup(label, smooth_checkpoint, ¤t);
|
||||
|
||||
/* start stream replication */
|
||||
if (stream_wal)
|
||||
{
|
||||
@ -160,11 +165,6 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
|
||||
pthread_create(&stream_thread, NULL, (void *(*)(void *)) StreamLog, dst_backup_path);
|
||||
}
|
||||
|
||||
/* notify start of backup to PostgreSQL server */
|
||||
time2iso(label, lengthof(label), current.start_time);
|
||||
strncat(label, " with pg_arman", lengthof(label));
|
||||
pg_start_backup(label, smooth_checkpoint, ¤t);
|
||||
|
||||
if(!from_replica)
|
||||
{
|
||||
/* If backup_label does not exist in $PGDATA, stop taking backup */
|
||||
@ -1435,10 +1435,15 @@ StreamLog(void *arg)
|
||||
if (!RunIdentifySystem(conn, NULL, &starttli, &startpos, NULL))
|
||||
disconnect_and_exit(1);
|
||||
|
||||
/*
|
||||
* We must use startpos as start_lsn from start_backup
|
||||
*/
|
||||
startpos = current.start_lsn;
|
||||
|
||||
/*
|
||||
* Always start streaming at the beginning of a segment
|
||||
*/
|
||||
|
||||
startpos -= startpos % XLOG_SEG_SIZE;
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user