aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/spgist/spgutils.c
diff options
context:
space:
mode:
authorKevin Grittner <kgrittn@postgresql.org>2016-04-08 14:30:10 -0500
committerKevin Grittner <kgrittn@postgresql.org>2016-04-08 14:30:10 -0500
commit8b65cf4c5edabdcae45ceaef7b9ac236879aae50 (patch)
treef4412d3e9bc0db823ac32e08fac8e3124b42ff02 /src/backend/access/spgist/spgutils.c
parent689f9a058854a1a32e994818dd6d79f49d8f8a1b (diff)
downloadpostgresql-8b65cf4c5edabdcae45ceaef7b9ac236879aae50.tar.gz
postgresql-8b65cf4c5edabdcae45ceaef7b9ac236879aae50.zip
Modify BufferGetPage() to prepare for "snapshot too old" feature
This patch is a no-op patch which is intended to reduce the chances of failures of omission once the functional part of the "snapshot too old" patch goes in. It adds parameters for snapshot, relation, and an enum to specify whether the snapshot age check needs to be done for the page at this point. This initial patch passes NULL for the first two new parameters and BGP_NO_SNAPSHOT_TEST for the third. The follow-on patch will change the places where the test needs to be made.
Diffstat (limited to 'src/backend/access/spgist/spgutils.c')
-rw-r--r--src/backend/access/spgist/spgutils.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/backend/access/spgist/spgutils.c b/src/backend/access/spgist/spgutils.c
index 201203f91a3..f4bcbeeb4a8 100644
--- a/src/backend/access/spgist/spgutils.c
+++ b/src/backend/access/spgist/spgutils.c
@@ -126,7 +126,8 @@ spgGetCache(Relation index)
metabuffer = ReadBuffer(index, SPGIST_METAPAGE_BLKNO);
LockBuffer(metabuffer, BUFFER_LOCK_SHARE);
- metadata = SpGistPageGetMeta(BufferGetPage(metabuffer));
+ metadata = SpGistPageGetMeta
+ (BufferGetPage(metabuffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST));
if (metadata->magicNumber != SPGIST_MAGIC_NUMBER)
elog(ERROR, "index \"%s\" is not an SP-GiST index",
@@ -206,7 +207,8 @@ SpGistNewBuffer(Relation index)
*/
if (ConditionalLockBuffer(buffer))
{
- Page page = BufferGetPage(buffer);
+ Page page = BufferGetPage(buffer, NULL, NULL,
+ BGP_NO_SNAPSHOT_TEST);
if (PageIsNew(page))
return buffer; /* OK to use, if never initialized */
@@ -256,7 +258,8 @@ SpGistUpdateMetaPage(Relation index)
if (ConditionalLockBuffer(metabuffer))
{
- metadata = SpGistPageGetMeta(BufferGetPage(metabuffer));
+ metadata = SpGistPageGetMeta
+ (BufferGetPage(metabuffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST));
metadata->lastUsedPages = cache->lastUsedPages;
MarkBufferDirty(metabuffer);
@@ -333,7 +336,9 @@ allocNewBuffer(Relation index, int flags)
blkFlags |= GBUF_NULLS;
cache->lastUsedPages.cachedPage[blkFlags].blkno = blkno;
cache->lastUsedPages.cachedPage[blkFlags].freeSpace =
- PageGetExactFreeSpace(BufferGetPage(buffer));
+ PageGetExactFreeSpace
+ (BufferGetPage(buffer, NULL, NULL,
+ BGP_NO_SNAPSHOT_TEST));
UnlockReleaseBuffer(buffer);
}
}
@@ -401,7 +406,7 @@ SpGistGetBuffer(Relation index, int flags, int needSpace, bool *isNew)
return allocNewBuffer(index, flags);
}
- page = BufferGetPage(buffer);
+ page = BufferGetPage(buffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST);
if (PageIsNew(page) || SpGistPageIsDeleted(page) || PageIsEmpty(page))
{
@@ -460,7 +465,7 @@ SpGistSetLastUsedPage(Relation index, Buffer buffer)
SpGistCache *cache = spgGetCache(index);
SpGistLastUsedPage *lup;
int freeSpace;
- Page page = BufferGetPage(buffer);
+ Page page = BufferGetPage(buffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST);
BlockNumber blkno = BufferGetBlockNumber(buffer);
int flags;
@@ -508,7 +513,7 @@ void
SpGistInitBuffer(Buffer b, uint16 f)
{
Assert(BufferGetPageSize(b) == BLCKSZ);
- SpGistInitPage(BufferGetPage(b), f);
+ SpGistInitPage(BufferGetPage(b, NULL, NULL, BGP_NO_SNAPSHOT_TEST), f);
}
/*