@@ -858,6 +858,10 @@ wait_wal_lsn(XLogRecPtr lsn, bool wait_prev_segment)
858
858
859
859
if (file_exists )
860
860
{
861
+ /* Do not check LSN for previous WAL segment */
862
+ if (wait_prev_segment )
863
+ return ;
864
+
861
865
/*
862
866
* A WAL segment found. Check LSN on it.
863
867
*/
@@ -874,15 +878,22 @@ wait_wal_lsn(XLogRecPtr lsn, bool wait_prev_segment)
874
878
875
879
/* Inform user if WAL segment is absent in first attempt */
876
880
if (try_count == 1 )
877
- elog (INFO , "wait for LSN %X/%X in archived WAL segment %s" ,
878
- (uint32 ) (lsn >> 32 ), (uint32 ) lsn , wal_segment_full_path );
881
+ {
882
+ if (wait_prev_segment )
883
+ elog (INFO , "wait for WAL segment %s to be archived" ,
884
+ wal_segment_full_path );
885
+ else
886
+ elog (INFO , "wait for LSN %X/%X in archived WAL segment %s" ,
887
+ (uint32 ) (lsn >> 32 ), (uint32 ) lsn , wal_segment_full_path );
888
+ }
879
889
880
890
if (timeout > 0 && try_count > timeout )
881
891
{
882
892
if (file_exists )
883
893
elog (ERROR , "WAL segment %s was archived, "
884
894
"but target LSN %X/%X could not be archived in %d seconds" ,
885
895
wal_segment , (uint32 ) (lsn >> 32 ), (uint32 ) lsn , timeout );
896
+ /* If WAL segment doesn't exist or we wait for previous segment */
886
897
else
887
898
elog (ERROR ,
888
899
"switched WAL segment %s could not be archived in %d seconds" ,
0 commit comments