diff options
author | Kevin Grittner <kgrittn@postgresql.org> | 2016-04-20 08:31:19 -0500 |
---|---|---|
committer | Kevin Grittner <kgrittn@postgresql.org> | 2016-04-20 08:31:19 -0500 |
commit | a343e223a5c33a7283a6d8b255c9dbc48dbc5061 (patch) | |
tree | f02f3de305180170d8d5e51120861ae6770b31e8 /src/backend/access/heap/visibilitymap.c | |
parent | 4db0d2d2fe935e086dfd26c00f707dab298b443c (diff) |
Revert no-op changes to BufferGetPage()
The reverted changes were intended to force a choice of whether any
newly-added BufferGetPage() calls needed to be accompanied by a
test of the snapshot age, to support the "snapshot too old"
feature. Such an accompanying test is needed in about 7% of the
cases, where the page is being used as part of a scan rather than
positioning for other purposes (such as DML or vacuuming). The
additional effort required for back-patching, and the doubt whether
the intended benefit would really be there, have indicated it is
best just to rely on developers to do the right thing based on
comments and existing usage, as we do with many other conventions.
This change should have little or no effect on generated executable
code.
Motivated by the back-patching pain of Tom Lane and Robert Haas
Diffstat (limited to 'src/backend/access/heap/visibilitymap.c')
-rw-r--r-- | src/backend/access/heap/visibilitymap.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c index 694d78406f3..eaab4beccbc 100644 --- a/src/backend/access/heap/visibilitymap.c +++ b/src/backend/access/heap/visibilitymap.c @@ -179,8 +179,7 @@ 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, NULL, NULL, - BGP_NO_SNAPSHOT_TEST)); + map = PageGetContents(BufferGetPage(buf)); if (map[mapByte] & mask) { @@ -288,7 +287,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, NULL, NULL, BGP_NO_SNAPSHOT_TEST); + page = BufferGetPage(vmBuf); map = (uint8 *)PageGetContents(page); LockBuffer(vmBuf, BUFFER_LOCK_EXCLUSIVE); @@ -313,8 +312,7 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf, */ if (XLogHintBitIsNeeded()) { - Page heapPage = BufferGetPage(heapBuf, NULL, NULL, - BGP_NO_SNAPSHOT_TEST); + Page heapPage = BufferGetPage(heapBuf); /* caller is expected to set PD_ALL_VISIBLE first */ Assert(PageIsAllVisible(heapPage)); @@ -379,8 +377,7 @@ visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *buf) return false; } - map = PageGetContents(BufferGetPage(*buf, NULL, NULL, - BGP_NO_SNAPSHOT_TEST)); + map = PageGetContents(BufferGetPage(*buf)); /* * A single byte read is atomic. There could be memory-ordering effects @@ -429,8 +426,7 @@ 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, NULL, NULL, BGP_NO_SNAPSHOT_TEST)); + map = (unsigned char *) PageGetContents(BufferGetPage(mapBuffer)); for (i = 0; i < MAPSIZE; i++) { @@ -497,7 +493,7 @@ visibilitymap_truncate(Relation rel, BlockNumber nheapblocks) return; } - page = BufferGetPage(mapBuffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST); + page = BufferGetPage(mapBuffer); map = PageGetContents(page); LockBuffer(mapBuffer, BUFFER_LOCK_EXCLUSIVE); @@ -591,9 +587,8 @@ vm_readbuf(Relation rel, BlockNumber blkno, bool extend) */ buf = ReadBufferExtended(rel, VISIBILITYMAP_FORKNUM, blkno, RBM_ZERO_ON_ERROR, NULL); - if (PageIsNew(BufferGetPage(buf, NULL, NULL, BGP_NO_SNAPSHOT_TEST))) - PageInit(BufferGetPage(buf, NULL, NULL, BGP_NO_SNAPSHOT_TEST), - BLCKSZ, 0); + if (PageIsNew(BufferGetPage(buf))) + PageInit(BufferGetPage(buf), BLCKSZ, 0); return buf; } |