diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2012-12-28 13:06:15 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2012-12-28 13:06:15 -0300 |
commit | 5ab3af46ddd2f2c2b248f1ffdb688b394d4bb387 (patch) | |
tree | 6150244dc25064e933170880cab2037a79682f65 /src/backend/access/gist | |
parent | 24eca7977ed208de33791af8890975ffcf086598 (diff) | |
download | postgresql-5ab3af46ddd2f2c2b248f1ffdb688b394d4bb387.tar.gz postgresql-5ab3af46ddd2f2c2b248f1ffdb688b394d4bb387.zip |
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
Diffstat (limited to 'src/backend/access/gist')
-rw-r--r-- | src/backend/access/gist/gist.c | 14 | ||||
-rw-r--r-- | src/backend/access/gist/gistget.c | 2 | ||||
-rw-r--r-- | src/backend/access/gist/gistvacuum.c | 2 | ||||
-rw-r--r-- | src/backend/access/gist/gistxlog.c | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 9c6625bba3a..700e97afc39 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -561,8 +561,7 @@ gistdoinsert(Relation r, IndexTuple itup, Size freespace, GISTSTATE *giststate) } if (stack->blkno != GIST_ROOT_BLKNO && - XLByteLT(stack->parent->lsn, - GistPageGetOpaque(stack->page)->nsn)) + stack->parent->lsn < GistPageGetOpaque(stack->page)->nsn) { /* * Concurrent split detected. There's no guarantee that the @@ -620,7 +619,7 @@ gistdoinsert(Relation r, IndexTuple itup, Size freespace, GISTSTATE *giststate) xlocked = true; stack->page = (Page) BufferGetPage(stack->buffer); - if (!XLByteEQ(PageGetLSN(stack->page), stack->lsn)) + if (PageGetLSN(stack->page) != stack->lsn) { /* the page was changed while we unlocked it, retry */ continue; @@ -708,8 +707,8 @@ gistdoinsert(Relation r, IndexTuple itup, Size freespace, GISTSTATE *giststate) */ } else if (GistFollowRight(stack->page) || - XLByteLT(stack->parent->lsn, - GistPageGetOpaque(stack->page)->nsn)) + stack->parent->lsn < + GistPageGetOpaque(stack->page)->nsn) { /* * The page was split while we momentarily unlocked the @@ -794,7 +793,7 @@ gistFindPath(Relation r, BlockNumber child, OffsetNumber *downlinkoffnum) if (GistFollowRight(page)) elog(ERROR, "concurrent GiST page split was incomplete"); - if (top->parent && XLByteLT(top->parent->lsn, GistPageGetOpaque(page)->nsn) && + if (top->parent && top->parent->lsn < GistPageGetOpaque(page)->nsn && GistPageGetOpaque(page)->rightlink != InvalidBlockNumber /* sanity check */ ) { /* @@ -864,7 +863,8 @@ gistFindCorrectParent(Relation r, GISTInsertStack *child) parent->page = (Page) BufferGetPage(parent->buffer); /* here we don't need to distinguish between split and page update */ - if (child->downlinkoffnum == InvalidOffsetNumber || !XLByteEQ(parent->lsn, PageGetLSN(parent->page))) + if (child->downlinkoffnum == InvalidOffsetNumber || + parent->lsn != PageGetLSN(parent->page)) { /* parent is changed, look child in right links until found */ OffsetNumber i, diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index 2253e7c0eb7..0e1fd80280b 100644 --- a/src/backend/access/gist/gistget.c +++ b/src/backend/access/gist/gistget.c @@ -263,7 +263,7 @@ gistScanPage(IndexScanDesc scan, GISTSearchItem *pageItem, double *myDistances, */ if (!XLogRecPtrIsInvalid(pageItem->data.parentlsn) && (GistFollowRight(page) || - XLByteLT(pageItem->data.parentlsn, opaque->nsn)) && + pageItem->data.parentlsn < opaque->nsn) && opaque->rightlink != InvalidBlockNumber /* sanity check */ ) { /* There was a page split, follow right link to add pages */ diff --git a/src/backend/access/gist/gistvacuum.c b/src/backend/access/gist/gistvacuum.c index f2a7a872662..3fbcc6f52c0 100644 --- a/src/backend/access/gist/gistvacuum.c +++ b/src/backend/access/gist/gistvacuum.c @@ -114,7 +114,7 @@ pushStackIfSplited(Page page, GistBDItem *stack) GISTPageOpaque opaque = GistPageGetOpaque(page); if (stack->blkno != GIST_ROOT_BLKNO && !XLogRecPtrIsInvalid(stack->parentlsn) && - (GistFollowRight(page) || XLByteLT(stack->parentlsn, opaque->nsn)) && + (GistFollowRight(page) || stack->parentlsn < opaque->nsn) && opaque->rightlink != InvalidBlockNumber /* sanity check */ ) { /* split page detected, install right link to the stack */ diff --git a/src/backend/access/gist/gistxlog.c b/src/backend/access/gist/gistxlog.c index f9c8fcbcf59..f802c23f723 100644 --- a/src/backend/access/gist/gistxlog.c +++ b/src/backend/access/gist/gistxlog.c @@ -64,7 +64,7 @@ gistRedoClearFollowRight(XLogRecPtr lsn, XLogRecord *record, int block_index, * of this record, because the updated NSN is not included in the full * page image. */ - if (!XLByteLT(lsn, PageGetLSN(page))) + if (lsn >= PageGetLSN(page)) { GistPageGetOpaque(page)->nsn = lsn; GistClearFollowRight(page); @@ -119,7 +119,7 @@ gistRedoPageUpdateRecord(XLogRecPtr lsn, XLogRecord *record) page = (Page) BufferGetPage(buffer); /* nothing more to do if change already applied */ - if (XLByteLE(lsn, PageGetLSN(page))) + if (lsn <= PageGetLSN(page)) { UnlockReleaseBuffer(buffer); return; |