@ -849,7 +849,7 @@ XLogInsertRecord(XLogRecData *rdata,
if ( doPageWrites & &
( ! prevDoPageWrites | |
( fpw_lsn ! = InvalidXLogRecPtr & & fpw_lsn < = RedoRecPtr ) ) )
( XLogRecPtrIsValid ( fpw_lsn ) & & fpw_lsn < = RedoRecPtr ) ) )
{
/*
* Oops , some buffer now needs to be backed up that the caller
@ -883,7 +883,7 @@ XLogInsertRecord(XLogRecData *rdata,
* Those checks are only needed for records that can contain buffer
* references , and an XLOG_SWITCH record never does .
*/
Assert ( fpw_lsn = = InvalidXLogRecPtr ) ;
Assert ( ! XLogRecPtrIsValid ( fpw_lsn ) ) ;
WALInsertLockAcquireExclusive ( ) ;
inserted = ReserveXLogSwitch ( & StartPos , & EndPos , & rechdr - > xl_prev ) ;
}
@ -898,7 +898,7 @@ XLogInsertRecord(XLogRecData *rdata,
* not check RedoRecPtr before inserting the record ; we just need to
* update it afterwards .
*/
Assert ( fpw_lsn = = InvalidXLogRecPtr ) ;
Assert ( ! XLogRecPtrIsValid ( fpw_lsn ) ) ;
WALInsertLockAcquireExclusive ( ) ;
ReserveXLogInsertLocation ( rechdr - > xl_tot_len , & StartPos , & EndPos ,
& rechdr - > xl_prev ) ;
@ -1603,7 +1603,7 @@ WaitXLogInsertionsToFinish(XLogRecPtr upto)
*/
} while ( insertingat < upto ) ;
if ( insertingat ! = InvalidXLogRecPtr & & insertingat < finishedUpto )
if ( XLogRecPtrIsValid ( insertingat ) & & insertingat < finishedUpto )
finishedUpto = insertingat ;
}
@ -1762,7 +1762,7 @@ WALReadFromBuffers(char *dstbuf, XLogRecPtr startptr, Size count,
if ( RecoveryInProgress ( ) | | tli ! = GetWALInsertionTimeLine ( ) )
return 0 ;
Assert ( ! XLogRecPtrIsInv alid( startptr ) ) ;
Assert ( XLogRecPtrIsV alid( startptr ) ) ;
/*
* Caller should ensure that the requested data has been inserted into WAL
@ -2717,7 +2717,7 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
* available is replayed in this case . This also saves from extra locks
* taken on the control file from the startup process .
*/
if ( XLogRecPtrIsInv alid( LocalMinRecoveryPoint ) & & InRecovery )
if ( ! XLogRecPtrIsV alid( LocalMinRecoveryPoint ) & & InRecovery )
{
updateMinRecoveryPoint = false ;
return ;
@ -2729,7 +2729,7 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
LocalMinRecoveryPoint = ControlFile - > minRecoveryPoint ;
LocalMinRecoveryPointTLI = ControlFile - > minRecoveryPointTLI ;
if ( XLogRecPtrIsInv alid( LocalMinRecoveryPoint ) )
if ( ! XLogRecPtrIsV alid( LocalMinRecoveryPoint ) )
updateMinRecoveryPoint = false ;
else if ( force | | LocalMinRecoveryPoint < lsn )
{
@ -3149,7 +3149,7 @@ XLogNeedsFlush(XLogRecPtr record)
* which cannot update its local copy of minRecoveryPoint as long as
* it has not replayed all WAL available when doing crash recovery .
*/
if ( XLogRecPtrIsInv alid( LocalMinRecoveryPoint ) & & InRecovery )
if ( ! XLogRecPtrIsV alid( LocalMinRecoveryPoint ) & & InRecovery )
{
updateMinRecoveryPoint = false ;
return false ;
@ -3170,7 +3170,7 @@ XLogNeedsFlush(XLogRecPtr record)
* process doing crash recovery , which should not update the control
* file value if crash recovery is still running .
*/
if ( XLogRecPtrIsInv alid( LocalMinRecoveryPoint ) )
if ( ! XLogRecPtrIsV alid( LocalMinRecoveryPoint ) )
updateMinRecoveryPoint = false ;
/* check again */
@ -5935,7 +5935,7 @@ StartupXLOG(void)
*/
if ( InRecovery & &
( EndOfLog < LocalMinRecoveryPoint | |
! XLogRecPtrIsInv alid( ControlFile - > backupStartPoint ) ) )
XLogRecPtrIsV alid( ControlFile - > backupStartPoint ) ) )
{
/*
* Ran off end of WAL before reaching end - of - backup WAL record , or
@ -5945,7 +5945,7 @@ StartupXLOG(void)
*/
if ( ArchiveRecoveryRequested | | ControlFile - > backupEndRequired )
{
if ( ! XLogRecPtrIsInv alid( ControlFile - > backupStartPoint ) | | ControlFile - > backupEndRequired )
if ( XLogRecPtrIsV alid( ControlFile - > backupStartPoint ) | | ControlFile - > backupEndRequired )
ereport ( FATAL ,
( errcode ( ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE ) ,
errmsg ( " WAL ends before end of online backup " ) ,
@ -6047,7 +6047,7 @@ StartupXLOG(void)
* ( It ' s critical to first write an OVERWRITE_CONTRECORD message , which
* we ' ll do as soon as we ' re open for writing new WAL . )
*/
if ( ! XLogRecPtrIsInv alid( missingContrecPtr ) )
if ( XLogRecPtrIsV alid( missingContrecPtr ) )
{
/*
* We should only have a missingContrecPtr if we ' re not switching to a
@ -6057,7 +6057,7 @@ StartupXLOG(void)
* disregard .
*/
Assert ( newTLI = = endOfRecoveryInfo - > lastRecTLI ) ;
Assert ( ! XLogRecPtrIsInv alid( abortedRecPtr ) ) ;
Assert ( XLogRecPtrIsV alid( abortedRecPtr ) ) ;
EndOfLog = missingContrecPtr ;
}
@ -6161,9 +6161,9 @@ StartupXLOG(void)
LocalSetXLogInsertAllowed ( ) ;
/* If necessary, write overwrite-contrecord before doing anything else */
if ( ! XLogRecPtrIsInv alid( abortedRecPtr ) )
if ( XLogRecPtrIsV alid( abortedRecPtr ) )
{
Assert ( ! XLogRecPtrIsInv alid( missingContrecPtr ) ) ;
Assert ( XLogRecPtrIsV alid( missingContrecPtr ) ) ;
CreateOverwriteContrecordRecord ( abortedRecPtr , missingContrecPtr , newTLI ) ;
}
@ -7363,7 +7363,7 @@ CreateCheckPoint(int flags)
* Update the average distance between checkpoints if the prior checkpoint
* exists .
*/
if ( PriorRedoPtr ! = InvalidXLogRecPtr )
if ( XLogRecPtrIsValid ( PriorRedoPtr ) )
UpdateCheckPointDistanceEstimate ( RedoRecPtr - PriorRedoPtr ) ;
INJECTION_POINT ( " checkpoint-before-old-wal-removal " , NULL ) ;
@ -7693,7 +7693,7 @@ CreateRestartPoint(int flags)
* restartpoint . It ' s assumed that flushing the buffers will do that as a
* side - effect .
*/
if ( XLogRecPtrIsInv alid( lastCheckPointRecPtr ) | |
if ( ! XLogRecPtrIsV alid( lastCheckPointRecPtr ) | |
lastCheckPoint . redo < = ControlFile - > checkPointCopy . redo )
{
ereport ( DEBUG2 ,
@ -7811,7 +7811,7 @@ CreateRestartPoint(int flags)
* Update the average distance between checkpoints / restartpoints if the
* prior checkpoint exists .
*/
if ( PriorRedoPtr ! = InvalidXLogRecPtr )
if ( XLogRecPtrIsValid ( PriorRedoPtr ) )
UpdateCheckPointDistanceEstimate ( RedoRecPtr - PriorRedoPtr ) ;
/*
@ -7936,7 +7936,7 @@ GetWALAvailability(XLogRecPtr targetLSN)
/*
* slot does not reserve WAL . Either deactivated , or has never been active
*/
if ( XLogRecPtrIsInv alid( targetLSN ) )
if ( ! XLogRecPtrIsV alid( targetLSN ) )
return WALAVAIL_INVALID_LSN ;
/*
@ -8018,7 +8018,7 @@ KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
/* Calculate how many segments are kept by slots. */
keep = XLogGetReplicationSlotMinimumLSN ( ) ;
if ( keep ! = InvalidXLogRecPtr & & keep < recptr )
if ( XLogRecPtrIsValid ( keep ) & & keep < recptr )
{
XLByteToSeg ( keep , segno , wal_segment_size ) ;
@ -8045,7 +8045,7 @@ KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
* summarized .
*/
keep = GetOldestUnsummarizedLSN ( NULL , NULL ) ;
if ( keep ! = InvalidXLogRecPtr )
if ( XLogRecPtrIsValid ( keep ) )
{
XLogSegNo unsummarized_segno ;
@ -8352,8 +8352,8 @@ xlog_redo(XLogReaderState *record)
* never arrive .
*/
if ( ArchiveRecoveryRequested & &
! XLogRecPtrIsInv alid( ControlFile - > backupStartPoint ) & &
XLogRecPtrIsInv alid( ControlFile - > backupEndPoint ) )
XLogRecPtrIsV alid( ControlFile - > backupStartPoint ) & &
! XLogRecPtrIsV alid( ControlFile - > backupEndPoint ) )
ereport ( PANIC ,
( errmsg ( " online backup was canceled, recovery cannot continue " ) ) ) ;
@ -8603,7 +8603,7 @@ xlog_redo(XLogReaderState *record)
LocalMinRecoveryPoint = ControlFile - > minRecoveryPoint ;
LocalMinRecoveryPointTLI = ControlFile - > minRecoveryPointTLI ;
}
if ( LocalMinRecoveryPoint ! = InvalidXLogRecPtr & & LocalMinRecoveryPoint < lsn )
if ( XLogRecPtrIsValid ( LocalMinRecoveryPoint ) & & LocalMinRecoveryPoint < lsn )
{
TimeLineID replayTLI ;