aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/spgist/spgdoinsert.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/spgdoinsert.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/spgdoinsert.c')
-rw-r--r--src/backend/access/spgist/spgdoinsert.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/backend/access/spgist/spgdoinsert.c b/src/backend/access/spgist/spgdoinsert.c
index f090ca528b1..b780bfea44d 100644
--- a/src/backend/access/spgist/spgdoinsert.c
+++ b/src/backend/access/spgist/spgdoinsert.c
@@ -451,7 +451,7 @@ moveLeafs(Relation index, SpGistState *state,
/* Find a leaf page that will hold them */
nbuf = SpGistGetBuffer(index, GBUF_LEAF | (isNulls ? GBUF_NULLS : 0),
size, &xlrec.newPage);
- npage = BufferGetPage(nbuf);
+ npage = BufferGetPage(nbuf, NULL, NULL, BGP_NO_SNAPSHOT_TEST);
nblkno = BufferGetBlockNumber(nbuf);
Assert(nblkno != current->blkno);
@@ -1037,7 +1037,8 @@ doPickSplit(Relation index, SpGistState *state,
nodePageSelect = (uint8 *) palloc(sizeof(uint8) * out.nNodes);
curspace = currentFreeSpace;
- newspace = PageGetExactFreeSpace(BufferGetPage(newLeafBuffer));
+ newspace = PageGetExactFreeSpace
+ (BufferGetPage(newLeafBuffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST));
for (i = 0; i < out.nNodes; i++)
{
if (leafSizes[i] <= curspace)
@@ -1070,7 +1071,9 @@ doPickSplit(Relation index, SpGistState *state,
/* Repeat the node assignment process --- should succeed now */
curspace = currentFreeSpace;
- newspace = PageGetExactFreeSpace(BufferGetPage(newLeafBuffer));
+ newspace = PageGetExactFreeSpace
+ (BufferGetPage(newLeafBuffer, NULL, NULL,
+ BGP_NO_SNAPSHOT_TEST));
for (i = 0; i < out.nNodes; i++)
{
if (leafSizes[i] <= curspace)
@@ -1201,7 +1204,9 @@ doPickSplit(Relation index, SpGistState *state,
it->nextOffset = InvalidOffsetNumber;
/* Insert it on page */
- newoffset = SpGistPageAddNewItem(state, BufferGetPage(leafBuffer),
+ newoffset = SpGistPageAddNewItem(state,
+ BufferGetPage(leafBuffer, NULL, NULL,
+ BGP_NO_SNAPSHOT_TEST),
(Item) it, it->size,
&startOffsets[leafPageSelect[i]],
false);
@@ -1275,7 +1280,8 @@ doPickSplit(Relation index, SpGistState *state,
/* Repoint "current" at the new inner tuple */
current->buffer = newInnerBuffer;
current->blkno = BufferGetBlockNumber(current->buffer);
- current->page = BufferGetPage(current->buffer);
+ current->page = BufferGetPage(current->buffer, NULL, NULL,
+ BGP_NO_SNAPSHOT_TEST);
xlrec.offnumInner = current->offnum =
SpGistPageAddNewItem(state, current->page,
(Item) innerTuple, innerTuple->size,
@@ -1391,24 +1397,22 @@ doPickSplit(Relation index, SpGistState *state,
/* Update page LSNs on all affected pages */
if (newLeafBuffer != InvalidBuffer)
{
- Page page = BufferGetPage(newLeafBuffer);
-
+ Page page = BufferGetPage(newLeafBuffer, NULL, NULL,
+ BGP_NO_SNAPSHOT_TEST);
PageSetLSN(page, recptr);
}
if (saveCurrent.buffer != InvalidBuffer)
{
- Page page = BufferGetPage(saveCurrent.buffer);
-
+ Page page = BufferGetPage(saveCurrent.buffer, NULL, NULL,
+ BGP_NO_SNAPSHOT_TEST);
PageSetLSN(page, recptr);
}
PageSetLSN(current->page, recptr);
if (parent->buffer != InvalidBuffer)
- {
PageSetLSN(parent->page, recptr);
- }
}
END_CRIT_SECTION();
@@ -1578,7 +1582,8 @@ spgAddNodeAction(Relation index, SpGistState *state,
newInnerTuple->size + sizeof(ItemIdData),
&xlrec.newPage);
current->blkno = BufferGetBlockNumber(current->buffer);
- current->page = BufferGetPage(current->buffer);
+ current->page = BufferGetPage(current->buffer, NULL, NULL,
+ BGP_NO_SNAPSHOT_TEST);
/*
* Let's just make real sure new current isn't same as old. Right now
@@ -1793,7 +1798,9 @@ spgSplitNodeAction(Relation index, SpGistState *state,
{
postfixBlkno = BufferGetBlockNumber(newBuffer);
xlrec.offnumPostfix = postfixOffset =
- SpGistPageAddNewItem(state, BufferGetPage(newBuffer),
+ SpGistPageAddNewItem(state,
+ BufferGetPage(newBuffer, NULL, NULL,
+ BGP_NO_SNAPSHOT_TEST),
(Item) postfixTuple, postfixTuple->size,
NULL, false);
MarkBufferDirty(newBuffer);
@@ -1840,7 +1847,8 @@ spgSplitNodeAction(Relation index, SpGistState *state,
if (newBuffer != InvalidBuffer)
{
- PageSetLSN(BufferGetPage(newBuffer), recptr);
+ PageSetLSN(BufferGetPage(newBuffer, NULL, NULL,
+ BGP_NO_SNAPSHOT_TEST), recptr);
}
}
@@ -1984,7 +1992,8 @@ spgdoinsert(Relation index, SpGistState *state,
/* inner tuple can be stored on the same page as parent one */
current.buffer = parent.buffer;
}
- current.page = BufferGetPage(current.buffer);
+ current.page = BufferGetPage(current.buffer, NULL, NULL,
+ BGP_NO_SNAPSHOT_TEST);
/* should not arrive at a page of the wrong type */
if (isnull ? !SpGistPageStoresNulls(current.page) :