From 3b4974dd4fa27f7a726b49cb8b16828818fe4093 Mon Sep 17 00:00:00 2001
From: kommih <haribabuk@fast.au.fujitsu.com>
Date: Mon, 22 Oct 2018 16:07:07 +1100
Subject: [PATCH 2/3] Remove the extra Tuple visibility function

In heapgettup_pagemode the tuple visiblity check is added
during the early devlopment of pluggable storage, but the visibility
check is already carried out in heapgetpage function itself.
---
 src/backend/access/heap/heapam.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index ec99d0bcae..ef6b4c3e54 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -947,31 +947,25 @@ heapgettup_pagemode(HeapScanDesc scan,
 			/*
 			 * if current tuple qualifies, return it.
 			 */
-			if (HeapTupleSatisfies(tuple, scan->rs_scan.rs_snapshot, scan->rs_cbuf))
+			if (key != NULL)
 			{
-				/*
-				 * if current tuple qualifies, return it.
-				 */
-				if (key != NULL)
-				{
-					bool		valid;
+				bool		valid;
 
-					HeapKeyTest(tuple, RelationGetDescr(scan->rs_scan.rs_rd),
-								nkeys, key, valid);
-					if (valid)
-					{
-						scan->rs_cindex = lineindex;
-						LockBuffer(scan->rs_cbuf, BUFFER_LOCK_UNLOCK);
-						return;
-					}
-				}
-				else
+				HeapKeyTest(tuple, RelationGetDescr(scan->rs_scan.rs_rd),
+							nkeys, key, valid);
+				if (valid)
 				{
 					scan->rs_cindex = lineindex;
 					LockBuffer(scan->rs_cbuf, BUFFER_LOCK_UNLOCK);
 					return;
 				}
 			}
+			else
+			{
+				scan->rs_cindex = lineindex;
+				LockBuffer(scan->rs_cbuf, BUFFER_LOCK_UNLOCK);
+				return;
+			}
 
 			/*
 			 * otherwise move to the next item on the page
-- 
2.18.0.windows.1

