mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Use XLogRecPtrIsValid() in various places
Now that commit 06edbed478 has introduced XLogRecPtrIsValid(), we can
use that instead of:
- XLogRecPtrIsInvalid()
- direct comparisons with InvalidXLogRecPtr
- direct comparisons with literal 0
This makes the code more consistent.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aQB7EvGqrbZXrMlg@ip-10-97-1-34.eu-west-3.compute.internal
This commit is contained in:
@@ -493,7 +493,7 @@ SyncRepReleaseWaiters(void)
|
||||
if (MyWalSnd->sync_standby_priority == 0 ||
|
||||
(MyWalSnd->state != WALSNDSTATE_STREAMING &&
|
||||
MyWalSnd->state != WALSNDSTATE_STOPPING) ||
|
||||
XLogRecPtrIsInvalid(MyWalSnd->flush))
|
||||
!XLogRecPtrIsValid(MyWalSnd->flush))
|
||||
{
|
||||
announce_next_takeover = true;
|
||||
return;
|
||||
@@ -676,11 +676,11 @@ SyncRepGetOldestSyncRecPtr(XLogRecPtr *writePtr,
|
||||
XLogRecPtr flush = sync_standbys[i].flush;
|
||||
XLogRecPtr apply = sync_standbys[i].apply;
|
||||
|
||||
if (XLogRecPtrIsInvalid(*writePtr) || *writePtr > write)
|
||||
if (!XLogRecPtrIsValid(*writePtr) || *writePtr > write)
|
||||
*writePtr = write;
|
||||
if (XLogRecPtrIsInvalid(*flushPtr) || *flushPtr > flush)
|
||||
if (!XLogRecPtrIsValid(*flushPtr) || *flushPtr > flush)
|
||||
*flushPtr = flush;
|
||||
if (XLogRecPtrIsInvalid(*applyPtr) || *applyPtr > apply)
|
||||
if (!XLogRecPtrIsValid(*applyPtr) || *applyPtr > apply)
|
||||
*applyPtr = apply;
|
||||
}
|
||||
}
|
||||
@@ -799,7 +799,7 @@ SyncRepGetCandidateStandbys(SyncRepStandbyData **standbys)
|
||||
continue;
|
||||
|
||||
/* Must have a valid flush position */
|
||||
if (XLogRecPtrIsInvalid(stby->flush))
|
||||
if (!XLogRecPtrIsValid(stby->flush))
|
||||
continue;
|
||||
|
||||
/* OK, it's a candidate */
|
||||
|
||||
Reference in New Issue
Block a user