mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
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.
This commit is contained in:
@ -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) :
|
||||
|
Reference in New Issue
Block a user