@@ -151,6 +151,11 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
151
151
if (current .backup_mode != BACKUP_MODE_DIFF_PTRACK && !disable_ptrack_clear )
152
152
pg_ptrack_clear ();
153
153
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
+
154
159
/* start stream replication */
155
160
if (stream_wal )
156
161
{
@@ -160,11 +165,6 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
160
165
pthread_create (& stream_thread , NULL , (void * (* )(void * )) StreamLog , dst_backup_path );
161
166
}
162
167
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
-
168
168
if (!from_replica )
169
169
{
170
170
/* If backup_label does not exist in $PGDATA, stop taking backup */
@@ -1435,10 +1435,15 @@ StreamLog(void *arg)
1435
1435
if (!RunIdentifySystem (conn , NULL , & starttli , & startpos , NULL ))
1436
1436
disconnect_and_exit (1 );
1437
1437
1438
+ /*
1439
+ * We must use startpos as start_lsn from start_backup
1440
+ */
1441
+ startpos = current .start_lsn ;
1438
1442
1439
1443
/*
1440
1444
* Always start streaming at the beginning of a segment
1441
1445
*/
1446
+
1442
1447
startpos -= startpos % XLOG_SEG_SIZE ;
1443
1448
1444
1449
/*
0 commit comments