summaryrefslogtreecommitdiff
path: root/contrib/bloom
diff options
context:
space:
mode:
authorKevin Grittner2016-04-20 13:31:19 +0000
committerKevin Grittner2016-04-20 13:31:19 +0000
commita343e223a5c33a7283a6d8b255c9dbc48dbc5061 (patch)
treef02f3de305180170d8d5e51120861ae6770b31e8 /contrib/bloom
parent4db0d2d2fe935e086dfd26c00f707dab298b443c (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 'contrib/bloom')
-rw-r--r--contrib/bloom/blinsert.c3
-rw-r--r--contrib/bloom/blscan.c4
-rw-r--r--contrib/bloom/blutils.c8
-rw-r--r--contrib/bloom/blvacuum.c2
4 files changed, 7 insertions, 10 deletions
diff --git a/contrib/bloom/blinsert.c b/contrib/bloom/blinsert.c
index 4e3fe2feb2e..a3602178938 100644
--- a/contrib/bloom/blinsert.c
+++ b/contrib/bloom/blinsert.c
@@ -204,8 +204,7 @@ blinsert(Relation index, Datum *values, bool *isnull,
*/
metaBuffer = ReadBuffer(index, BLOOM_METAPAGE_BLKNO);
LockBuffer(metaBuffer, BUFFER_LOCK_SHARE);
- metaData = BloomPageGetMeta(BufferGetPage(metaBuffer, NULL, NULL,
- BGP_NO_SNAPSHOT_TEST));
+ metaData = BloomPageGetMeta(BufferGetPage(metaBuffer));
if (metaData->nEnd > metaData->nStart)
{
diff --git a/contrib/bloom/blscan.c b/contrib/bloom/blscan.c
index e75ed3d6136..fc82f543738 100644
--- a/contrib/bloom/blscan.c
+++ b/contrib/bloom/blscan.c
@@ -138,8 +138,8 @@ blgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
blkno, RBM_NORMAL, bas);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
- page = BufferGetPage(buffer, scan->xs_snapshot, scan->indexRelation,
- BGP_TEST_FOR_OLD_SNAPSHOT);
+ page = BufferGetPage(buffer);
+ TestForOldSnapshot(scan->xs_snapshot, scan->indexRelation, page);
if (!BloomPageIsDeleted(page))
{
diff --git a/contrib/bloom/blutils.c b/contrib/bloom/blutils.c
index 5e506eaee40..71a93e0cd46 100644
--- a/contrib/bloom/blutils.c
+++ b/contrib/bloom/blutils.c
@@ -139,12 +139,11 @@ initBloomState(BloomState *state, Relation index)
buffer = ReadBuffer(index, BLOOM_METAPAGE_BLKNO);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
- page = BufferGetPage(buffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST);
+ page = BufferGetPage(buffer);
if (!BloomPageIsMeta(page))
elog(ERROR, "Relation is not a bloom index");
- meta = BloomPageGetMeta(BufferGetPage(buffer, NULL, NULL,
- BGP_NO_SNAPSHOT_TEST));
+ meta = BloomPageGetMeta(BufferGetPage(buffer));
if (meta->magickNumber != BLOOM_MAGICK_NUMBER)
elog(ERROR, "Relation is not a bloom index");
@@ -317,8 +316,7 @@ BloomNewBuffer(Relation index)
*/
if (ConditionalLockBuffer(buffer))
{
- Page page = BufferGetPage(buffer, NULL, NULL,
- BGP_NO_SNAPSHOT_TEST);
+ Page page = BufferGetPage(buffer);
if (PageIsNew(page))
return buffer; /* OK to use, if never initialized */
diff --git a/contrib/bloom/blvacuum.c b/contrib/bloom/blvacuum.c
index 7467afb7b92..5ae33499386 100644
--- a/contrib/bloom/blvacuum.c
+++ b/contrib/bloom/blvacuum.c
@@ -194,7 +194,7 @@ blvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
buffer = ReadBufferExtended(index, MAIN_FORKNUM, blkno,
RBM_NORMAL, info->strategy);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
- page = BufferGetPage(buffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST);
+ page = (Page) BufferGetPage(buffer);
if (BloomPageIsDeleted(page))
{