From 575fb1f93128ebfd8125c769de628f91e0d5c592 Mon Sep 17 00:00:00 2001
From: Melanie Plageman <melanieplageman@gmail.com>
Date: Mon, 12 Feb 2024 18:13:41 -0500
Subject: [PATCH v1 01/11] Remove table_scan_bitmap_next_tuple parameter tbmres

Future commits will remove the input TBMIterateResult from
table_scan_bitmap_next_block() as the streaming read API will be
responsible for iterating through the blocks in the bitmap and not
BitmapHeapNext(). Given that this parameter will not be set from
BitmapHeapNext(), it no longer makes sense to use it as a means of
communication between table_scan_bitmap_next_tuple() and
table_scan_bitmap_next_block().
---
 src/backend/access/heap/heapam_handler.c  | 1 -
 src/backend/executor/nodeBitmapHeapscan.c | 2 +-
 src/include/access/tableam.h              | 7 -------
 3 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c
index d15a02b2be7..716d477e271 100644
--- a/src/backend/access/heap/heapam_handler.c
+++ b/src/backend/access/heap/heapam_handler.c
@@ -2228,7 +2228,6 @@ heapam_scan_bitmap_next_block(TableScanDesc scan,
 
 static bool
 heapam_scan_bitmap_next_tuple(TableScanDesc scan,
-							  TBMIterateResult *tbmres,
 							  TupleTableSlot *slot)
 {
 	HeapScanDesc hscan = (HeapScanDesc) scan;
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index c1e81ebed63..d670939246b 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -304,7 +304,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
 			/*
 			 * Attempt to fetch tuple from AM.
 			 */
-			if (!table_scan_bitmap_next_tuple(scan, tbmres, slot))
+			if (!table_scan_bitmap_next_tuple(scan, slot))
 			{
 				/* nothing more to look at on this page */
 				node->tbmres = tbmres = NULL;
diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h
index 5f8474871d2..4d495216f07 100644
--- a/src/include/access/tableam.h
+++ b/src/include/access/tableam.h
@@ -810,15 +810,10 @@ typedef struct TableAmRoutine
 	 * Fetch the next tuple of a bitmap table scan into `slot` and return true
 	 * if a visible tuple was found, false otherwise.
 	 *
-	 * For some AMs it will make more sense to do all the work referencing
-	 * `tbmres` contents in scan_bitmap_next_block, for others it might be
-	 * better to defer more work to this callback.
-	 *
 	 * Optional callback, but either both scan_bitmap_next_block and
 	 * scan_bitmap_next_tuple need to exist, or neither.
 	 */
 	bool		(*scan_bitmap_next_tuple) (TableScanDesc scan,
-										   struct TBMIterateResult *tbmres,
 										   TupleTableSlot *slot);
 
 	/*
@@ -1980,7 +1975,6 @@ table_scan_bitmap_next_block(TableScanDesc scan,
  */
 static inline bool
 table_scan_bitmap_next_tuple(TableScanDesc scan,
-							 struct TBMIterateResult *tbmres,
 							 TupleTableSlot *slot)
 {
 	/*
@@ -1992,7 +1986,6 @@ table_scan_bitmap_next_tuple(TableScanDesc scan,
 		elog(ERROR, "unexpected table_scan_bitmap_next_tuple call during logical decoding");
 
 	return scan->rs_rd->rd_tableam->scan_bitmap_next_tuple(scan,
-														   tbmres,
 														   slot);
 }
 
-- 
2.37.2

