diff options
| author | Álvaro Herrera <alvherre@kurilemu.de> | 2025-11-06 20:33:57 +0100 |
|---|---|---|
| committer | Álvaro Herrera <alvherre@kurilemu.de> | 2025-11-06 20:33:57 +0100 |
| commit | a2b02293bc65dbb2401cb19c724f52c6ee0f2faf (patch) | |
| tree | f982dafa5b106905027b0e11fe9cdee9fc0bab6f /src/backend/access/gist | |
| parent | 06edbed478625829b19c35d0c17d805be588afa6 (diff) | |
Use XLogRecPtrIsValid() in various places
Now that commit 06edbed47862 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
Diffstat (limited to 'src/backend/access/gist')
| -rw-r--r-- | src/backend/access/gist/gist.c | 4 | ||||
| -rw-r--r-- | src/backend/access/gist/gistget.c | 4 | ||||
| -rw-r--r-- | src/backend/access/gist/gistutil.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 5213cd71e97..3fb1a1285c5 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -682,7 +682,7 @@ gistdoinsert(Relation r, IndexTuple itup, Size freespace, state.stack = stack = stack->parent; } - if (XLogRecPtrIsInvalid(stack->lsn)) + if (!XLogRecPtrIsValid(stack->lsn)) stack->buffer = ReadBuffer(state.r, stack->blkno); /* @@ -698,7 +698,7 @@ gistdoinsert(Relation r, IndexTuple itup, Size freespace, stack->page = BufferGetPage(stack->buffer); stack->lsn = xlocked ? PageGetLSN(stack->page) : BufferGetLSNAtomic(stack->buffer); - Assert(!RelationNeedsWAL(state.r) || !XLogRecPtrIsInvalid(stack->lsn)); + Assert(!RelationNeedsWAL(state.r) || XLogRecPtrIsValid(stack->lsn)); /* * If this page was split but the downlink was never inserted to the diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index 387d9972345..9ba45acfff3 100644 --- a/src/backend/access/gist/gistget.c +++ b/src/backend/access/gist/gistget.c @@ -46,7 +46,7 @@ gistkillitems(IndexScanDesc scan) bool killedsomething = false; Assert(so->curBlkno != InvalidBlockNumber); - Assert(!XLogRecPtrIsInvalid(so->curPageLSN)); + Assert(XLogRecPtrIsValid(so->curPageLSN)); Assert(so->killedItems != NULL); buffer = ReadBuffer(scan->indexRelation, so->curBlkno); @@ -353,7 +353,7 @@ gistScanPage(IndexScanDesc scan, GISTSearchItem *pageItem, * parentlsn < nsn), or if the system crashed after a page split but * before the downlink was inserted into the parent. */ - if (!XLogRecPtrIsInvalid(pageItem->data.parentlsn) && + if (XLogRecPtrIsValid(pageItem->data.parentlsn) && (GistFollowRight(page) || pageItem->data.parentlsn < GistPageGetNSN(page)) && opaque->rightlink != InvalidBlockNumber /* sanity check */ ) diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c index 98b79608341..75272827837 100644 --- a/src/backend/access/gist/gistutil.c +++ b/src/backend/access/gist/gistutil.c @@ -1040,7 +1040,7 @@ gistGetFakeLSN(Relation rel) Assert(!RelationNeedsWAL(rel)); /* No need for an actual record if we already have a distinct LSN */ - if (!XLogRecPtrIsInvalid(lastlsn) && lastlsn == currlsn) + if (XLogRecPtrIsValid(lastlsn) && lastlsn == currlsn) currlsn = gistXLogAssignLSN(); lastlsn = currlsn; |
