diff options
author | Kevin Grittner <kgrittn@postgresql.org> | 2016-04-08 14:30:10 -0500 |
---|---|---|
committer | Kevin Grittner <kgrittn@postgresql.org> | 2016-04-08 14:30:10 -0500 |
commit | 8b65cf4c5edabdcae45ceaef7b9ac236879aae50 (patch) | |
tree | f4412d3e9bc0db823ac32e08fac8e3124b42ff02 /src/backend/access/heap/visibilitymap.c | |
parent | 689f9a058854a1a32e994818dd6d79f49d8f8a1b (diff) | |
download | postgresql-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/heap/visibilitymap.c')
-rw-r--r-- | src/backend/access/heap/visibilitymap.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c index eaab4beccbc..694d78406f3 100644 --- a/src/backend/access/heap/visibilitymap.c +++ b/src/backend/access/heap/visibilitymap.c @@ -179,7 +179,8 @@ visibilitymap_clear(Relation rel, BlockNumber heapBlk, Buffer buf) elog(ERROR, "wrong buffer passed to visibilitymap_clear"); LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE); - map = PageGetContents(BufferGetPage(buf)); + map = PageGetContents(BufferGetPage(buf, NULL, NULL, + BGP_NO_SNAPSHOT_TEST)); if (map[mapByte] & mask) { @@ -287,7 +288,7 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf, if (!BufferIsValid(vmBuf) || BufferGetBlockNumber(vmBuf) != mapBlock) elog(ERROR, "wrong VM buffer passed to visibilitymap_set"); - page = BufferGetPage(vmBuf); + page = BufferGetPage(vmBuf, NULL, NULL, BGP_NO_SNAPSHOT_TEST); map = (uint8 *)PageGetContents(page); LockBuffer(vmBuf, BUFFER_LOCK_EXCLUSIVE); @@ -312,7 +313,8 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf, */ if (XLogHintBitIsNeeded()) { - Page heapPage = BufferGetPage(heapBuf); + Page heapPage = BufferGetPage(heapBuf, NULL, NULL, + BGP_NO_SNAPSHOT_TEST); /* caller is expected to set PD_ALL_VISIBLE first */ Assert(PageIsAllVisible(heapPage)); @@ -377,7 +379,8 @@ visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *buf) return false; } - map = PageGetContents(BufferGetPage(*buf)); + map = PageGetContents(BufferGetPage(*buf, NULL, NULL, + BGP_NO_SNAPSHOT_TEST)); /* * A single byte read is atomic. There could be memory-ordering effects @@ -426,7 +429,8 @@ visibilitymap_count(Relation rel, BlockNumber *all_visible, BlockNumber *all_fro * immediately stale anyway if anyone is concurrently setting or * clearing bits, and we only really need an approximate value. */ - map = (unsigned char *) PageGetContents(BufferGetPage(mapBuffer)); + map = (unsigned char *) PageGetContents(BufferGetPage + (mapBuffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST)); for (i = 0; i < MAPSIZE; i++) { @@ -493,7 +497,7 @@ visibilitymap_truncate(Relation rel, BlockNumber nheapblocks) return; } - page = BufferGetPage(mapBuffer); + page = BufferGetPage(mapBuffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST); map = PageGetContents(page); LockBuffer(mapBuffer, BUFFER_LOCK_EXCLUSIVE); @@ -587,8 +591,9 @@ vm_readbuf(Relation rel, BlockNumber blkno, bool extend) */ buf = ReadBufferExtended(rel, VISIBILITYMAP_FORKNUM, blkno, RBM_ZERO_ON_ERROR, NULL); - if (PageIsNew(BufferGetPage(buf))) - PageInit(BufferGetPage(buf), BLCKSZ, 0); + if (PageIsNew(BufferGetPage(buf, NULL, NULL, BGP_NO_SNAPSHOT_TEST))) + PageInit(BufferGetPage(buf, NULL, NULL, BGP_NO_SNAPSHOT_TEST), + BLCKSZ, 0); return buf; } |