@@ -1528,22 +1528,22 @@ wait_wal_lsn(XLogRecPtr target_lsn, bool is_start_lsn, TimeLineID tli,
15281528 * If we failed to get target LSN in a reasonable time, try
15291529 * to get LSN of last valid record prior to the target LSN. But only
15301530 * in case of a backup from a replica.
1531- * Note, that with NullOffset target_lsn we do not wait
1531+ * Note, that with NullXRecOff target_lsn we do not wait
15321532 * for 'timeout / 2' seconds before going for previous record,
15331533 * because such LSN cannot be delivered at all.
15341534 *
15351535 * There are two cases for this:
15361536 * 1. Replica returned readpoint LSN which just do not exists. We want to look
15371537 * for previous record in the same(!) WAL segment which endpoint points to this LSN.
1538- * 2. Replica returened endpoint LSN with 0 offset . We want to look
1538+ * 2. Replica returened endpoint LSN with NullXRecOff . We want to look
15391539 * for previous record which endpoint points greater or equal LSN in previous WAL segment.
15401540 */
15411541 if (current .from_replica &&
15421542 (XRecOffIsNull (target_lsn ) || try_count > timeout / 2 ))
15431543 {
15441544 XLogRecPtr res ;
15451545
1546- res = get_last_wal_lsn (wal_segment_dir , current .start_lsn , target_lsn , tli ,
1546+ res = get_prior_record_lsn (wal_segment_dir , current .start_lsn , target_lsn , tli ,
15471547 in_prev_segment , instance_config .xlog_seg_size );
15481548
15491549 if (!XLogRecPtrIsInvalid (res ))
@@ -1803,7 +1803,7 @@ pg_stop_backup(pgBackup *backup, PGconn *pg_startbackup_conn,
18031803
18041804 if (!XRecOffIsValid (stop_backup_lsn_tmp ))
18051805 {
1806- /* It is ok for replica to return STOP LSN with null offset */
1806+ /* It is ok for replica to return STOP LSN with NullXRecOff */
18071807 if (backup -> from_replica && XRecOffIsNull (stop_backup_lsn_tmp ))
18081808 {
18091809 char * xlog_path ,
@@ -1820,7 +1820,7 @@ pg_stop_backup(pgBackup *backup, PGconn *pg_startbackup_conn,
18201820
18211821 /*
18221822 * Note: even with gdb it is very hard to produce automated tests for
1823- * contrecord + null_offset STOP_LSN , so emulate it for manual testing.
1823+ * contrecord + NullXRecOff , so emulate it for manual testing.
18241824 */
18251825 //stop_backup_lsn_tmp = stop_backup_lsn_tmp - XLOG_SEG_SIZE;
18261826 //elog(WARNING, "New Invalid stop_backup_lsn value %X/%X",
@@ -1841,7 +1841,7 @@ pg_stop_backup(pgBackup *backup, PGconn *pg_startbackup_conn,
18411841 /*
18421842 * Note, that there is no guarantee that corresponding WAL file even exists.
18431843 * Replica may return LSN from future and keep staying in present.
1844- * Or it can return LSN with invalid XRecOff .
1844+ * Or it can return LSN with NullXRecOff .
18451845 *
18461846 * That's bad, since we want to get real LSN to save it in backup label file
18471847 * and to use it in WAL validation.
@@ -1851,17 +1851,16 @@ pg_stop_backup(pgBackup *backup, PGconn *pg_startbackup_conn,
18511851 * look for the first valid record in it.
18521852 * It solves the problem of occasional invalid XRecOff on write-busy system.
18531853 * 2. Failing that, look for record in previous segment with endpoint
1854- * equal or greater than stop_lsn. It may(!) solve the problem of 0 offset
1854+ * equal or greater than stop_lsn. It may(!) solve the problem of NullXRecOff
18551855 * on write-idle system. If that fails too, error out.
1856- * //TODO what kind of record that refers to?
18571856 */
18581857
18591858 /* Wait for segment with current stop_lsn, it is ok for it to never arrive */
18601859 wait_wal_lsn (stop_backup_lsn_tmp , false, backup -> tli ,
18611860 false, true, WARNING , stream_wal );
18621861
18631862 /* Get the first record in segment with current stop_lsn */
1864- lsn_tmp = get_first_wal_lsn (xlog_path , segno , backup -> tli ,
1863+ lsn_tmp = get_first_record_lsn (xlog_path , segno , backup -> tli ,
18651864 instance_config .xlog_seg_size );
18661865
18671866 /* Check that returned LSN is valid and greater than stop_lsn */
0 commit comments