From f8a6bf806a24ef40cbc45b1bce1179b803fea36e Mon Sep 17 00:00:00 2001 From: HuSen8891 Date: Thu, 7 Mar 2024 10:19:09 +0800 Subject: [PATCH] Add new callback 'scan_flags' for table access method The table access method supports different features due to the different implementation, this callback is used to indicate what the AM can do, what features the AM can support. --- src/backend/access/aocs/aocsam_handler.c | 7 +++++++ src/backend/access/appendonly/appendonlyam.c | 6 ++++++ src/backend/access/appendonly/appendonlyam_handler.c | 1 + src/backend/access/heap/heapam.c | 6 ++++++ src/backend/access/heap/heapam_handler.c | 1 + src/include/access/heapam.h | 1 + src/include/cdb/cdbappendonlyam.h | 1 + 7 files changed, 23 insertions(+) diff --git a/src/backend/access/aocs/aocsam_handler.c b/src/backend/access/aocs/aocsam_handler.c index a310138cded..a156921c774 100644 --- a/src/backend/access/aocs/aocsam_handler.c +++ b/src/backend/access/aocs/aocsam_handler.c @@ -757,6 +757,12 @@ aoco_getnextslot(TableScanDesc scan, ScanDirection direction, TupleTableSlot *sl return false; } +static int +aoco_scan_flags(Relation rel) +{ + return 0; +} + static Size aoco_parallelscan_estimate(Relation rel) { @@ -2402,6 +2408,7 @@ static TableAmRoutine ao_column_methods = { .scan_end = aoco_endscan, .scan_rescan = aoco_rescan, .scan_getnextslot = aoco_getnextslot, + .scan_flags = aoco_scan_flags, .parallelscan_estimate = aoco_parallelscan_estimate, .parallelscan_initialize = aoco_parallelscan_initialize, diff --git a/src/backend/access/appendonly/appendonlyam.c b/src/backend/access/appendonly/appendonlyam.c index 1c56ae0b946..0d75c348d11 100755 --- a/src/backend/access/appendonly/appendonlyam.c +++ b/src/backend/access/appendonly/appendonlyam.c @@ -1799,6 +1799,12 @@ appendonly_getnextslot(TableScanDesc scan, ScanDirection direction, TupleTableSl return false; } +int +appendonly_scan_flags(Relation relation) +{ + return 0; +} + static void closeFetchSegmentFile(AppendOnlyFetchDesc aoFetchDesc) { diff --git a/src/backend/access/appendonly/appendonlyam_handler.c b/src/backend/access/appendonly/appendonlyam_handler.c index fea0028596b..60302e2110c 100644 --- a/src/backend/access/appendonly/appendonlyam_handler.c +++ b/src/backend/access/appendonly/appendonlyam_handler.c @@ -2345,6 +2345,7 @@ static const TableAmRoutine ao_row_methods = { .scan_end = appendonly_endscan, .scan_rescan = appendonly_rescan, .scan_getnextslot = appendonly_getnextslot, + .scan_flags = appendonly_scan_flags, .parallelscan_estimate = appendonly_parallelscan_estimate, .parallelscan_initialize = appendonly_parallelscan_initialize, diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 3a229b3027f..918c20c7643 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -1621,6 +1621,12 @@ heap_getnextslot_tidrange(TableScanDesc sscan, ScanDirection direction, return true; } +int +heap_scan_flags(Relation relation) +{ + return 0; +} + /* * heap_fetch - retrieve tuple with given tid * diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index c7b8fb0e86b..fa2959d020f 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -2597,6 +2597,7 @@ static const TableAmRoutine heapam_methods = { .scan_set_tidrange = heap_set_tidrange, .scan_getnextslot_tidrange = heap_getnextslot_tidrange, + .scan_flags = heap_scan_flags, .parallelscan_estimate = table_block_parallelscan_estimate, .parallelscan_initialize = table_block_parallelscan_initialize, diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 1a5d8d279e7..9a7601c40af 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -135,6 +135,7 @@ extern void heap_set_tidrange(TableScanDesc sscan, ItemPointer mintid, extern bool heap_getnextslot_tidrange(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot); +extern int heap_scan_flags(Relation relation); extern bool heap_fetch(Relation relation, Snapshot snapshot, HeapTuple tuple, Buffer *userbuf); extern bool heap_fetch_extended(Relation relation, Snapshot snapshot, diff --git a/src/include/cdb/cdbappendonlyam.h b/src/include/cdb/cdbappendonlyam.h index f060cabb6d2..2d0e3987da5 100644 --- a/src/include/cdb/cdbappendonlyam.h +++ b/src/include/cdb/cdbappendonlyam.h @@ -445,6 +445,7 @@ extern void appendonly_endscan(TableScanDesc scan); extern bool appendonly_getnextslot(TableScanDesc scan, ScanDirection direction, TupleTableSlot *slot); +extern int appendonly_scan_flags(Relation relation); extern AppendOnlyFetchDesc appendonly_fetch_init( Relation relation, Snapshot snapshot,