@@ -215,16 +215,6 @@ do_backup_database(parray *backup_list)
215
215
*/
216
216
if (current .backup_mode == BACKUP_MODE_DIFF_PAGE )
217
217
{
218
- /*
219
- * Switch to a new WAL segment. It is necessary to get archived WAL
220
- * segment, which includes start LSN of current backup.
221
- *
222
- * Do not switch for standby node and if backup is stream.
223
- */
224
- if (!from_replica && !stream_wal )
225
- pg_switch_wal ();
226
- if (!stream_wal )
227
- wait_archive_lsn (current .start_lsn , false);
228
218
/*
229
219
* Build the page map. Obtain information about changed pages
230
220
* reading WAL segments present in archives up to the point
@@ -593,6 +583,17 @@ pg_start_backup(const char *label, bool smooth, pgBackup *backup)
593
583
backup -> start_lsn = (XLogRecPtr ) ((uint64 )xlogid <<32 ) |xrecoff ;
594
584
595
585
PQclear (res );
586
+
587
+ /*
588
+ * Switch to a new WAL segment. It is necessary to get archived WAL
589
+ * segment, which includes start LSN of current backup.
590
+ *
591
+ * Do not switch for standby node and if backup is stream.
592
+ */
593
+ if (!from_replica && !stream_wal )
594
+ pg_switch_wal ();
595
+ if (!stream_wal )
596
+ wait_archive_lsn (backup -> start_lsn , false);
596
597
}
597
598
598
599
/*