From d3471dfa797ae83b97acb5404b31cafeac88492e Mon Sep 17 00:00:00 2001 From: kommih Date: Tue, 22 Jan 2019 11:29:20 +1100 Subject: [PATCH 2/2] Removal of scan_update_snapshot The snapshot structure is avaiable in the tablescandesc structure itself, so it can be accessed outside itself, no need of any callback. --- src/backend/access/heap/heapam.c | 18 ------------------ src/backend/access/heap/heapam_handler.c | 1 - src/backend/executor/nodeBitmapHeapscan.c | 6 +++++- src/include/access/heapam.h | 1 - src/include/access/tableam.h | 10 ---------- 5 files changed, 5 insertions(+), 31 deletions(-) diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 7f594b3e4f..6655a95433 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -1252,24 +1252,6 @@ heap_endscan(TableScanDesc sscan) pfree(scan); } -/* ---------------- - * heap_update_snapshot - * - * Update snapshot info in heap scan descriptor. - * ---------------- - */ -void -heap_update_snapshot(TableScanDesc sscan, Snapshot snapshot) -{ - HeapScanDesc scan = (HeapScanDesc) sscan; - - Assert(IsMVCCSnapshot(snapshot)); - - RegisterSnapshot(snapshot); - scan->rs_scan.rs_snapshot = snapshot; - scan->rs_scan.rs_temp_snap = true; -} - /* ---------------- * heap_getnext - retrieve next tuple in scan * diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index 62c5f9fa9f..3dc1444739 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -2308,7 +2308,6 @@ static const TableAmRoutine heapam_methods = { .scan_begin = heap_beginscan, .scan_end = heap_endscan, .scan_rescan = heap_rescan, - .scan_update_snapshot = heap_update_snapshot, .scan_getnextslot = heap_getnextslot, .parallelscan_estimate = table_block_parallelscan_estimate, diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index 59061c746b..b48ab5036c 100644 --- a/src/backend/executor/nodeBitmapHeapscan.c +++ b/src/backend/executor/nodeBitmapHeapscan.c @@ -954,5 +954,9 @@ ExecBitmapHeapInitializeWorker(BitmapHeapScanState *node, node->pstate = pstate; snapshot = RestoreSnapshot(pstate->phs_snapshot_data); - table_scan_update_snapshot(node->ss.ss_currentScanDesc, snapshot); + Assert(IsMVCCSnapshot(snapshot)); + + RegisterSnapshot(snapshot); + node->ss.ss_currentScanDesc->rs_snapshot = snapshot; + node->ss.ss_currentScanDesc->rs_temp_snap = true; } diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 7c9c4f5e98..dd67e7e270 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -182,7 +182,6 @@ extern void simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup); extern void heap_sync(Relation relation); -extern void heap_update_snapshot(TableScanDesc scan, Snapshot snapshot); extern TransactionId heap_compute_xid_horizon_for_tuples(Relation rel, ItemPointerData *items, diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h index 428ff90cad..092980e205 100644 --- a/src/include/access/tableam.h +++ b/src/include/access/tableam.h @@ -89,7 +89,6 @@ typedef struct TableAmRoutine void (*scan_end) (TableScanDesc scan); void (*scan_rescan) (TableScanDesc scan, struct ScanKeyData *key, bool set_params, bool allow_strat, bool allow_sync, bool allow_pagemode); - void (*scan_update_snapshot) (TableScanDesc scan, Snapshot snapshot); TupleTableSlot *(*scan_getnextslot) (TableScanDesc scan, ScanDirection direction, TupleTableSlot *slot); @@ -389,15 +388,6 @@ table_rescan_set_params(TableScanDesc scan, struct ScanKeyData *key, allow_pagemode); } -/* - * Update snapshot info in heap scan descriptor. - */ -static inline void -table_scan_update_snapshot(TableScanDesc scan, Snapshot snapshot) -{ - scan->rs_rd->rd_tableam->scan_update_snapshot(scan, snapshot); -} - static inline TupleTableSlot * table_scan_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot) { -- 2.18.0.windows.1