mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Remove obsolete XLogRecPtr macros
This gets rid of XLByteLT, XLByteLE, XLByteEQ and XLByteAdvance. These were useful for brevity when XLogRecPtrs were split in xlogid/xrecoff; but now that they are simple uint64's, they are just clutter. The only downside to making this change would be ease of backporting patches, but that has been negated by other substantive changes to the involved code anyway. The clarity of simpler expressions makes the change worthwhile. Most of the changes are mechanical, but in a couple of places, the patch author chose to invert the operator sense, making the code flow more logical (and more in line with preceding comments). Author: Andres Freund Eyeballed by Dimitri Fontaine and Alvaro Herrera
This commit is contained in:
@@ -120,7 +120,7 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN)
|
||||
* be a low cost check.
|
||||
*/
|
||||
if (!WalSndCtl->sync_standbys_defined ||
|
||||
XLByteLE(XactCommitLSN, WalSndCtl->lsn[mode]))
|
||||
XactCommitLSN <= WalSndCtl->lsn[mode])
|
||||
{
|
||||
LWLockRelease(SyncRepLock);
|
||||
return;
|
||||
@@ -287,7 +287,7 @@ SyncRepQueueInsert(int mode)
|
||||
* Stop at the queue element that we should after to ensure the queue
|
||||
* is ordered by LSN.
|
||||
*/
|
||||
if (XLByteLT(proc->waitLSN, MyProc->waitLSN))
|
||||
if (proc->waitLSN < MyProc->waitLSN)
|
||||
break;
|
||||
|
||||
proc = (PGPROC *) SHMQueuePrev(&(WalSndCtl->SyncRepQueue[mode]),
|
||||
@@ -428,12 +428,12 @@ SyncRepReleaseWaiters(void)
|
||||
* Set the lsn first so that when we wake backends they will release up to
|
||||
* this location.
|
||||
*/
|
||||
if (XLByteLT(walsndctl->lsn[SYNC_REP_WAIT_WRITE], MyWalSnd->write))
|
||||
if (walsndctl->lsn[SYNC_REP_WAIT_WRITE] < MyWalSnd->write)
|
||||
{
|
||||
walsndctl->lsn[SYNC_REP_WAIT_WRITE] = MyWalSnd->write;
|
||||
numwrite = SyncRepWakeQueue(false, SYNC_REP_WAIT_WRITE);
|
||||
}
|
||||
if (XLByteLT(walsndctl->lsn[SYNC_REP_WAIT_FLUSH], MyWalSnd->flush))
|
||||
if (walsndctl->lsn[SYNC_REP_WAIT_FLUSH] < MyWalSnd->flush)
|
||||
{
|
||||
walsndctl->lsn[SYNC_REP_WAIT_FLUSH] = MyWalSnd->flush;
|
||||
numflush = SyncRepWakeQueue(false, SYNC_REP_WAIT_FLUSH);
|
||||
@@ -543,7 +543,7 @@ SyncRepWakeQueue(bool all, int mode)
|
||||
/*
|
||||
* Assume the queue is ordered by LSN
|
||||
*/
|
||||
if (!all && XLByteLT(walsndctl->lsn[mode], proc->waitLSN))
|
||||
if (!all && walsndctl->lsn[mode] < proc->waitLSN)
|
||||
return numprocs;
|
||||
|
||||
/*
|
||||
@@ -640,7 +640,7 @@ SyncRepQueueIsOrderedByLSN(int mode)
|
||||
* Check the queue is ordered by LSN and that multiple procs don't
|
||||
* have matching LSNs
|
||||
*/
|
||||
if (XLByteLE(proc->waitLSN, lastLSN))
|
||||
if (proc->waitLSN <= lastLSN)
|
||||
return false;
|
||||
|
||||
lastLSN = proc->waitLSN;
|
||||
|
||||
Reference in New Issue
Block a user