From 8b65cf4c5edabdcae45ceaef7b9ac236879aae50 Mon Sep 17 00:00:00 2001 From: Kevin Grittner Date: Fri, 8 Apr 2016 14:30:10 -0500 Subject: 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. --- src/backend/access/gist/gistbuild.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/backend/access/gist/gistbuild.c') diff --git a/src/backend/access/gist/gistbuild.c b/src/backend/access/gist/gistbuild.c index 4e43a6932a4..8e7389c05f3 100644 --- a/src/backend/access/gist/gistbuild.c +++ b/src/backend/access/gist/gistbuild.c @@ -169,7 +169,7 @@ gistbuild(Relation heap, Relation index, IndexInfo *indexInfo) /* initialize the root page */ buffer = gistNewBuffer(index); Assert(BufferGetBlockNumber(buffer) == GIST_ROOT_BLKNO); - page = BufferGetPage(buffer); + page = BufferGetPage(buffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST); START_CRIT_SECTION(); @@ -589,7 +589,7 @@ gistProcessItup(GISTBuildState *buildstate, IndexTuple itup, buffer = ReadBuffer(indexrel, blkno); LockBuffer(buffer, GIST_EXCLUSIVE); - page = (Page) BufferGetPage(buffer); + page = BufferGetPage(buffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST); childoffnum = gistchoose(indexrel, page, itup, giststate); iid = PageGetItemId(page, childoffnum); idxtuple = (IndexTuple) PageGetItem(page, iid); @@ -699,7 +699,8 @@ gistbufferinginserttuples(GISTBuildState *buildstate, Buffer buffer, int level, */ if (is_split && BufferGetBlockNumber(buffer) == GIST_ROOT_BLKNO) { - Page page = BufferGetPage(buffer); + Page page = BufferGetPage(buffer, NULL, NULL, + BGP_NO_SNAPSHOT_TEST); OffsetNumber off; OffsetNumber maxoff; @@ -866,7 +867,7 @@ gistBufferingFindCorrectParent(GISTBuildState *buildstate, } buffer = ReadBuffer(buildstate->indexrel, parent); - page = BufferGetPage(buffer); + page = BufferGetPage(buffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST); LockBuffer(buffer, GIST_EXCLUSIVE); gistcheckpage(buildstate->indexrel, buffer); maxoff = PageGetMaxOffsetNumber(page); @@ -1067,7 +1068,7 @@ gistGetMaxLevel(Relation index) * pro forma. */ LockBuffer(buffer, GIST_SHARE); - page = (Page) BufferGetPage(buffer); + page = BufferGetPage(buffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST); if (GistPageIsLeaf(page)) { @@ -1167,7 +1168,8 @@ gistMemorizeAllDownlinks(GISTBuildState *buildstate, Buffer parentbuf) OffsetNumber maxoff; OffsetNumber off; BlockNumber parentblkno = BufferGetBlockNumber(parentbuf); - Page page = BufferGetPage(parentbuf); + Page page = BufferGetPage(parentbuf, NULL, NULL, + BGP_NO_SNAPSHOT_TEST); Assert(!GistPageIsLeaf(page)); -- cgit v1.2.3