@@ -239,7 +239,7 @@ do_backup_database(parray *backup_list)
239
239
240
240
if (ptrack_lsn > prev_backup -> stop_lsn )
241
241
{
242
- elog (ERROR ,"lsn from ptrack_control %lx differs fromlsn of previous ptrack backup %lx.\n"
242
+ elog (ERROR ,"LSN from ptrack_control %lx differs fromLSN of previous ptrack backup %lx.\n"
243
243
"Create new full backup before an incremental one." ,
244
244
ptrack_lsn ,prev_backup -> start_lsn );
245
245
}
@@ -714,7 +714,8 @@ pg_ptrack_get_and_clear(Oid tablespace_oid, Oid db_oid, Oid rel_oid,
714
714
}
715
715
716
716
/*
717
- * TODO Add comment
717
+ * Wait for target 'lsn' to be archived in archive 'wal' directory with
718
+ * WAL segment file.
718
719
*/
719
720
static void
720
721
wait_archive_lsn (XLogRecPtr lsn ,bool prev_segno )
@@ -729,7 +730,7 @@ wait_archive_lsn(XLogRecPtr lsn, bool prev_segno)
729
730
730
731
tli = get_current_timeline (false);
731
732
732
- /* Compute the name of the WAL file containig requestedlsn */
733
+ /* Compute the name of the WAL file containig requestedLSN */
733
734
XLByteToSeg (lsn ,targetSegNo );
734
735
if (prev_segno )
735
736
targetSegNo -- ;
@@ -747,14 +748,22 @@ wait_archive_lsn(XLogRecPtr lsn, bool prev_segno)
747
748
748
749
/* Inform user if WAL segment is absent in first attempt */
749
750
if (try_count == 1 )
750
- elog (INFO ,"wait forlsn %X/%X in archived WAL segment %s" ,
751
+ elog (INFO ,"wait forLSN %X/%X in archived WAL segment %s" ,
751
752
(uint32 ) (lsn >>32 ), (uint32 )lsn ,wal_path );
752
753
753
754
if (archive_timeout > 0 && try_count > archive_timeout )
754
755
elog (ERROR ,
755
756
"switched WAL segment %s could not be archived in %d seconds" ,
756
757
wal_file ,archive_timeout );
757
758
}
759
+
760
+ /*
761
+ * WAL segment was archived. Check LSN on it if we waited current WAL
762
+ * segment, not previous.
763
+ */
764
+ if (!prev_segno && !wal_contains_lsn (arclog_path ,lsn ,tli ))
765
+ elog (ERROR ,"WAL segment %s doesn't contain target LSN %X/%X" ,
766
+ wal_file , (uint32 ) (lsn >>32 ), (uint32 )lsn );
758
767
}
759
768
760
769
/*