Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65bb8b5

Browse files
committed
Try make stream replication right.
1 parentb6ceb7f commit65bb8b5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

‎backup.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
151151
if (current.backup_mode!=BACKUP_MODE_DIFF_PTRACK&& !disable_ptrack_clear)
152152
pg_ptrack_clear();
153153

154+
/* notify start of backup to PostgreSQL server */
155+
time2iso(label,lengthof(label),current.start_time);
156+
strncat(label," with pg_arman",lengthof(label));
157+
pg_start_backup(label,smooth_checkpoint,&current);
158+
154159
/* start stream replication */
155160
if (stream_wal)
156161
{
@@ -160,11 +165,6 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
160165
pthread_create(&stream_thread,NULL, (void*(*)(void*))StreamLog,dst_backup_path);
161166
}
162167

163-
/* notify start of backup to PostgreSQL server */
164-
time2iso(label,lengthof(label),current.start_time);
165-
strncat(label," with pg_arman",lengthof(label));
166-
pg_start_backup(label,smooth_checkpoint,&current);
167-
168168
if(!from_replica)
169169
{
170170
/* If backup_label does not exist in $PGDATA, stop taking backup */
@@ -1435,10 +1435,15 @@ StreamLog(void *arg)
14351435
if (!RunIdentifySystem(conn,NULL,&starttli,&startpos,NULL))
14361436
disconnect_and_exit(1);
14371437

1438+
/*
1439+
* We must use startpos as start_lsn from start_backup
1440+
*/
1441+
startpos=current.start_lsn;
14381442

14391443
/*
14401444
* Always start streaming at the beginning of a segment
14411445
*/
1446+
14421447
startpos-=startpos %XLOG_SEG_SIZE;
14431448

14441449
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp