PostgreSQL Source Code  git master
indexam.c File Reference
#include "postgres.h"
#include "access/amapi.h"
#include "access/relscan.h"
#include "access/transam.h"
#include "access/xlog.h"
#include "catalog/catalog.h"
#include "catalog/index.h"
#include "pgstat.h"
#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#include "storage/predicate.h"
#include "utils/snapmgr.h"
#include "utils/tqual.h"
Include dependency graph for indexam.c:

Go to the source code of this file.

Macros

#define RELATION_CHECKS
 
#define SCAN_CHECKS
 
#define CHECK_REL_PROCEDURE(pname)
 
#define CHECK_SCAN_PROCEDURE(pname)
 

Functions

static IndexScanDesc index_beginscan_internal (Relation indexRelation, int nkeys, int norderbys, Snapshot snapshot, ParallelIndexScanDesc pscan, bool temp_snap)
 
Relation index_open (Oid relationId, LOCKMODE lockmode)
 
void index_close (Relation relation, LOCKMODE lockmode)
 
bool index_insert (Relation indexRelation, Datum *values, bool *isnull, ItemPointer heap_t_ctid, Relation heapRelation, IndexUniqueCheck checkUnique, IndexInfo *indexInfo)
 
IndexScanDesc index_beginscan (Relation heapRelation, Relation indexRelation, Snapshot snapshot, int nkeys, int norderbys)
 
IndexScanDesc index_beginscan_bitmap (Relation indexRelation, Snapshot snapshot, int nkeys)
 
void index_rescan (IndexScanDesc scan, ScanKey keys, int nkeys, ScanKey orderbys, int norderbys)
 
void index_endscan (IndexScanDesc scan)
 
void index_markpos (IndexScanDesc scan)
 
void index_restrpos (IndexScanDesc scan)
 
Size index_parallelscan_estimate (Relation indexRelation, Snapshot snapshot)
 
void index_parallelscan_initialize (Relation heapRelation, Relation indexRelation, Snapshot snapshot, ParallelIndexScanDesc target)
 
void index_parallelrescan (IndexScanDesc scan)
 
IndexScanDesc index_beginscan_parallel (Relation heaprel, Relation indexrel, int nkeys, int norderbys, ParallelIndexScanDesc pscan)
 
ItemPointer index_getnext_tid (IndexScanDesc scan, ScanDirection direction)
 
HeapTuple index_fetch_heap (IndexScanDesc scan)
 
HeapTuple index_getnext (IndexScanDesc scan, ScanDirection direction)
 
int64 index_getbitmap (IndexScanDesc scan, TIDBitmap *bitmap)
 
IndexBulkDeleteResultindex_bulk_delete (IndexVacuumInfo *info, IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state)
 
IndexBulkDeleteResultindex_vacuum_cleanup (IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
 
bool index_can_return (Relation indexRelation, int attno)
 
RegProcedure index_getprocid (Relation irel, AttrNumber attnum, uint16 procnum)
 
FmgrInfoindex_getprocinfo (Relation irel, AttrNumber attnum, uint16 procnum)
 

Macro Definition Documentation

◆ CHECK_REL_PROCEDURE

#define CHECK_REL_PROCEDURE (   pname)
Value:
do { \
if (indexRelation->rd_amroutine->pname == NULL) \
elog(ERROR, "function %s is not defined for index %s", \
CppAsString(pname), RelationGetRelationName(indexRelation)); \
} while(0)
#define ERROR
Definition: elog.h:43
#define RelationGetRelationName(relation)
Definition: rel.h:445
#define CppAsString(identifier)
Definition: c.h:223

Definition at line 112 of file indexam.c.

Referenced by index_beginscan_internal(), index_bulk_delete(), index_insert(), and index_vacuum_cleanup().

◆ CHECK_SCAN_PROCEDURE

#define CHECK_SCAN_PROCEDURE (   pname)
Value:
do { \
if (scan->indexRelation->rd_amroutine->pname == NULL) \
elog(ERROR, "function %s is not defined for index %s", \
CppAsString(pname), RelationGetRelationName(scan->indexRelation)); \
} while(0)
#define ERROR
Definition: elog.h:43
#define RelationGetRelationName(relation)
Definition: rel.h:445
#define CppAsString(identifier)
Definition: c.h:223

Definition at line 119 of file indexam.c.

Referenced by index_endscan(), index_getbitmap(), index_getnext_tid(), index_markpos(), index_rescan(), and index_restrpos().

◆ RELATION_CHECKS

#define RELATION_CHECKS
Value:
( \
AssertMacro(RelationIsValid(indexRelation)), \
AssertMacro(PointerIsValid(indexRelation->rd_amroutine)), \
AssertMacro(!ReindexIsProcessingIndex(RelationGetRelid(indexRelation))) \
)
#define RelationIsValid(relation)
Definition: rel.h:398
bool ReindexIsProcessingIndex(Oid indexOid)
Definition: index.c:3982
#define PointerIsValid(pointer)
Definition: c.h:582
#define RelationGetRelid(relation)
Definition: rel.h:425

Definition at line 98 of file indexam.c.

Referenced by index_beginscan_internal(), index_bulk_delete(), index_can_return(), index_insert(), index_parallelscan_estimate(), index_parallelscan_initialize(), and index_vacuum_cleanup().

◆ SCAN_CHECKS

#define SCAN_CHECKS
Value:
( \
AssertMacro(IndexScanIsValid(scan)), \
AssertMacro(RelationIsValid(scan->indexRelation)), \
AssertMacro(PointerIsValid(scan->indexRelation->rd_amroutine)) \
)
#define RelationIsValid(relation)
Definition: rel.h:398
#define IndexScanIsValid(scan)
Definition: genam.h:128
#define PointerIsValid(pointer)
Definition: c.h:582

Definition at line 105 of file indexam.c.

Referenced by index_endscan(), index_getbitmap(), index_getnext_tid(), index_markpos(), index_parallelrescan(), index_rescan(), and index_restrpos().

Function Documentation

◆ index_beginscan()

IndexScanDesc index_beginscan ( Relation  heapRelation,
Relation  indexRelation,
Snapshot  snapshot,
int  nkeys,
int  norderbys 
)

Definition at line 222 of file indexam.c.

References IndexScanDescData::heapRelation, index_beginscan_internal(), and IndexScanDescData::xs_snapshot.

Referenced by check_exclusion_or_unique_constraint(), copy_heap_data(), get_actual_variable_range(), IndexNext(), IndexNextWithReorder(), IndexOnlyNext(), RelationFindReplTupleByIndex(), systable_beginscan(), and systable_beginscan_ordered().

226 {
227  IndexScanDesc scan;
228 
229  scan = index_beginscan_internal(indexRelation, nkeys, norderbys, snapshot, NULL, false);
230 
231  /*
232  * Save additional parameters into the scandesc. Everything else was set
233  * up by RelationGetIndexScan.
234  */
235  scan->heapRelation = heapRelation;
236  scan->xs_snapshot = snapshot;
237 
238  return scan;
239 }
Snapshot xs_snapshot
Definition: relscan.h:92
Relation heapRelation
Definition: relscan.h:90
static IndexScanDesc index_beginscan_internal(Relation indexRelation, int nkeys, int norderbys, Snapshot snapshot, ParallelIndexScanDesc pscan, bool temp_snap)
Definition: indexam.c:269

◆ index_beginscan_bitmap()

IndexScanDesc index_beginscan_bitmap ( Relation  indexRelation,
Snapshot  snapshot,
int  nkeys 
)

Definition at line 248 of file indexam.c.

References index_beginscan_internal(), and IndexScanDescData::xs_snapshot.

Referenced by ExecInitBitmapIndexScan().

251 {
252  IndexScanDesc scan;
253 
254  scan = index_beginscan_internal(indexRelation, nkeys, 0, snapshot, NULL, false);
255 
256  /*
257  * Save additional parameters into the scandesc. Everything else was set
258  * up by RelationGetIndexScan.
259  */
260  scan->xs_snapshot = snapshot;
261 
262  return scan;
263 }
Snapshot xs_snapshot
Definition: relscan.h:92
static IndexScanDesc index_beginscan_internal(Relation indexRelation, int nkeys, int norderbys, Snapshot snapshot, ParallelIndexScanDesc pscan, bool temp_snap)
Definition: indexam.c:269

◆ index_beginscan_internal()

static IndexScanDesc index_beginscan_internal ( Relation  indexRelation,
int  nkeys,
int  norderbys,
Snapshot  snapshot,
ParallelIndexScanDesc  pscan,
bool  temp_snap 
)
static

Definition at line 269 of file indexam.c.

References IndexAmRoutine::ambeginscan, IndexAmRoutine::ampredlocks, CHECK_REL_PROCEDURE, IndexScanDescData::parallel_scan, PredicateLockRelation(), RelationData::rd_amroutine, RELATION_CHECKS, RelationIncrementReferenceCount(), and IndexScanDescData::xs_temp_snap.

Referenced by index_beginscan(), index_beginscan_bitmap(), and index_beginscan_parallel().

272 {
273  IndexScanDesc scan;
274 
276  CHECK_REL_PROCEDURE(ambeginscan);
277 
278  if (!(indexRelation->rd_amroutine->ampredlocks))
279  PredicateLockRelation(indexRelation, snapshot);
280 
281  /*
282  * We hold a reference count to the relcache entry throughout the scan.
283  */
284  RelationIncrementReferenceCount(indexRelation);
285 
286  /*
287  * Tell the AM to open a scan.
288  */
289  scan = indexRelation->rd_amroutine->ambeginscan(indexRelation, nkeys,
290  norderbys);
291  /* Initialize information for parallel scan. */
292  scan->parallel_scan = pscan;
293  scan->xs_temp_snap = temp_snap;
294 
295  return scan;
296 }
ParallelIndexScanDesc parallel_scan
Definition: relscan.h:141
ambeginscan_function ambeginscan
Definition: amapi.h:208
#define RELATION_CHECKS
Definition: indexam.c:98
void PredicateLockRelation(Relation relation, Snapshot snapshot)
Definition: predicate.c:2498
bool ampredlocks
Definition: amapi.h:191
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
#define CHECK_REL_PROCEDURE(pname)
Definition: indexam.c:112
bool xs_temp_snap
Definition: relscan.h:98
void RelationIncrementReferenceCount(Relation rel)
Definition: relcache.c:2100

◆ index_beginscan_parallel()

IndexScanDesc index_beginscan_parallel ( Relation  heaprel,
Relation  indexrel,
int  nkeys,
int  norderbys,
ParallelIndexScanDesc  pscan 
)

Definition at line 497 of file indexam.c.

References Assert, IndexScanDescData::heapRelation, index_beginscan_internal(), ParallelIndexScanDescData::ps_relid, ParallelIndexScanDescData::ps_snapshot_data, RegisterSnapshot(), RelationGetRelid, RestoreSnapshot(), and IndexScanDescData::xs_snapshot.

Referenced by ExecIndexOnlyScanInitializeDSM(), ExecIndexOnlyScanInitializeWorker(), ExecIndexScanInitializeDSM(), and ExecIndexScanInitializeWorker().

499 {
500  Snapshot snapshot;
501  IndexScanDesc scan;
502 
503  Assert(RelationGetRelid(heaprel) == pscan->ps_relid);
504  snapshot = RestoreSnapshot(pscan->ps_snapshot_data);
505  RegisterSnapshot(snapshot);
506  scan = index_beginscan_internal(indexrel, nkeys, norderbys, snapshot,
507  pscan, true);
508 
509  /*
510  * Save additional parameters into the scandesc. Everything else was set
511  * up by index_beginscan_internal.
512  */
513  scan->heapRelation = heaprel;
514  scan->xs_snapshot = snapshot;
515 
516  return scan;
517 }
Snapshot RestoreSnapshot(char *start_address)
Definition: snapmgr.c:2127
Snapshot RegisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:863
Snapshot xs_snapshot
Definition: relscan.h:92
char ps_snapshot_data[FLEXIBLE_ARRAY_MEMBER]
Definition: relscan.h:150
Relation heapRelation
Definition: relscan.h:90
static IndexScanDesc index_beginscan_internal(Relation indexRelation, int nkeys, int norderbys, Snapshot snapshot, ParallelIndexScanDesc pscan, bool temp_snap)
Definition: indexam.c:269
#define Assert(condition)
Definition: c.h:688
#define RelationGetRelid(relation)
Definition: rel.h:425

◆ index_bulk_delete()

IndexBulkDeleteResult* index_bulk_delete ( IndexVacuumInfo info,
IndexBulkDeleteResult stats,
IndexBulkDeleteCallback  callback,
void *  callback_state 
)

Definition at line 744 of file indexam.c.

References IndexAmRoutine::ambulkdelete, CHECK_REL_PROCEDURE, IndexVacuumInfo::index, RelationData::rd_amroutine, and RELATION_CHECKS.

Referenced by lazy_vacuum_index(), and validate_index().

748 {
749  Relation indexRelation = info->index;
750 
752  CHECK_REL_PROCEDURE(ambulkdelete);
753 
754  return indexRelation->rd_amroutine->ambulkdelete(info, stats,
755  callback, callback_state);
756 }
ambulkdelete_function ambulkdelete
Definition: amapi.h:201
#define RELATION_CHECKS
Definition: indexam.c:98
Relation index
Definition: genam.h:46
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
#define CHECK_REL_PROCEDURE(pname)
Definition: indexam.c:112
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:48

◆ index_can_return()

bool index_can_return ( Relation  indexRelation,
int  attno 
)

Definition at line 784 of file indexam.c.

References IndexAmRoutine::amcanreturn, RelationData::rd_amroutine, and RELATION_CHECKS.

Referenced by get_relation_info(), and indexam_property().

785 {
787 
788  /* amcanreturn is optional; assume false if not provided by AM */
789  if (indexRelation->rd_amroutine->amcanreturn == NULL)
790  return false;
791 
792  return indexRelation->rd_amroutine->amcanreturn(indexRelation, attno);
793 }
#define RELATION_CHECKS
Definition: indexam.c:98
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
amcanreturn_function amcanreturn
Definition: amapi.h:203

◆ index_close()

void index_close ( Relation  relation,
LOCKMODE  lockmode 
)

Definition at line 177 of file indexam.c.

References Assert, LockInfoData::lockRelId, MAX_LOCKMODES, NoLock, RelationData::rd_lockInfo, RelationClose(), and UnlockRelationId().

Referenced by _bt_parallel_build_main(), ATExecAddIndex(), ATExecAddIndexConstraint(), ATExecReplicaIdentity(), AttachPartitionEnsureIndexes(), brin_page_items(), brincostestimate(), bt_index_check_internal(), build_indices(), BuildEventTriggerCache(), check_index_is_clusterable(), CheckIndexCompatible(), close_lo_relation(), copy_heap_data(), DefineIndex(), DefineRelation(), enum_endpoint(), enum_range_internal(), ExecCloseIndices(), ExecEndBitmapIndexScan(), ExecEndIndexOnlyScan(), ExecEndIndexScan(), ExecRefreshMatView(), get_actual_variable_range(), get_relation_info(), gin_clean_pending_list(), gincostestimate(), hash_bitmap_info(), index_create(), index_drop(), indexam_property(), infer_arbiter_indexes(), InitCatCachePhase2(), lookup_ts_config_cache(), pgstathashindex(), plan_create_index_workers(), refresh_by_match_merge(), reindex_index(), ReindexIndex(), RelationFindReplTupleByIndex(), RelationGetIndexAttrBitmap(), RelationTruncateIndexes(), systable_endscan(), toast_close_indexes(), transformTableLikeClause(), TryReuseIndex(), unique_key_recheck(), vac_close_indexes(), vac_open_indexes(), and validate_index().

178 {
179  LockRelId relid = relation->rd_lockInfo.lockRelId;
180 
181  Assert(lockmode >= NoLock && lockmode < MAX_LOCKMODES);
182 
183  /* The relcache does the real work... */
184  RelationClose(relation);
185 
186  if (lockmode != NoLock)
187  UnlockRelationId(&relid, lockmode);
188 }
LockRelId lockRelId
Definition: rel.h:44
void UnlockRelationId(LockRelId *relid, LOCKMODE lockmode)
Definition: lmgr.c:167
Definition: rel.h:36
#define NoLock
Definition: lockdefs.h:34
LockInfoData rd_lockInfo
Definition: rel.h:117
void RelationClose(Relation relation)
Definition: relcache.c:2133
#define MAX_LOCKMODES
Definition: lock.h:85
#define Assert(condition)
Definition: c.h:688

◆ index_endscan()

void index_endscan ( IndexScanDesc  scan)

Definition at line 341 of file indexam.c.

References IndexAmRoutine::amendscan, BufferIsValid, CHECK_SCAN_PROCEDURE, IndexScanDescData::indexRelation, IndexScanEnd(), InvalidBuffer, RelationData::rd_amroutine, RelationDecrementReferenceCount(), ReleaseBuffer(), SCAN_CHECKS, UnregisterSnapshot(), IndexScanDescData::xs_cbuf, IndexScanDescData::xs_snapshot, and IndexScanDescData::xs_temp_snap.

Referenced by check_exclusion_or_unique_constraint(), copy_heap_data(), ExecEndBitmapIndexScan(), ExecEndIndexOnlyScan(), ExecEndIndexScan(), get_actual_variable_range(), RelationFindReplTupleByIndex(), systable_endscan(), and systable_endscan_ordered().

342 {
343  SCAN_CHECKS;
344  CHECK_SCAN_PROCEDURE(amendscan);
345 
346  /* Release any held pin on a heap page */
347  if (BufferIsValid(scan->xs_cbuf))
348  {
349  ReleaseBuffer(scan->xs_cbuf);
350  scan->xs_cbuf = InvalidBuffer;
351  }
352 
353  /* End the AM's scan */
354  scan->indexRelation->rd_amroutine->amendscan(scan);
355 
356  /* Release index refcount acquired by index_beginscan */
358 
359  if (scan->xs_temp_snap)
361 
362  /* Release the scan data structure itself */
363  IndexScanEnd(scan);
364 }
Snapshot xs_snapshot
Definition: relscan.h:92
#define InvalidBuffer
Definition: buf.h:25
void ReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:3309
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
#define CHECK_SCAN_PROCEDURE(pname)
Definition: indexam.c:119
Relation indexRelation
Definition: relscan.h:91
void RelationDecrementReferenceCount(Relation rel)
Definition: relcache.c:2113
Buffer xs_cbuf
Definition: relscan.h:122
bool xs_temp_snap
Definition: relscan.h:98
amendscan_function amendscan
Definition: amapi.h:212
void IndexScanEnd(IndexScanDesc scan)
Definition: genam.c:146
void UnregisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:905
#define SCAN_CHECKS
Definition: indexam.c:105
#define BufferIsValid(bufnum)
Definition: bufmgr.h:114

◆ index_fetch_heap()

HeapTuple index_fetch_heap ( IndexScanDesc  scan)

Definition at line 584 of file indexam.c.

References BUFFER_LOCK_SHARE, BUFFER_LOCK_UNLOCK, heap_hot_search_buffer(), heap_page_prune_opt(), IndexScanDescData::heapRelation, IndexScanDescData::indexRelation, IsMVCCSnapshot, ItemPointerGetBlockNumber, IndexScanDescData::kill_prior_tuple, LockBuffer(), pgstat_count_heap_fetch, ReleaseAndReadBuffer(), HeapTupleData::t_self, IndexScanDescData::xactStartedInRecovery, IndexScanDescData::xs_cbuf, IndexScanDescData::xs_continue_hot, IndexScanDescData::xs_ctup, and IndexScanDescData::xs_snapshot.

Referenced by index_getnext(), and IndexOnlyNext().

585 {
586  ItemPointer tid = &scan->xs_ctup.t_self;
587  bool all_dead = false;
588  bool got_heap_tuple;
589 
590  /* We can skip the buffer-switching logic if we're in mid-HOT chain. */
591  if (!scan->xs_continue_hot)
592  {
593  /* Switch to correct buffer if we don't have it already */
594  Buffer prev_buf = scan->xs_cbuf;
595 
596  scan->xs_cbuf = ReleaseAndReadBuffer(scan->xs_cbuf,
597  scan->heapRelation,
599 
600  /*
601  * Prune page, but only if we weren't already on this page
602  */
603  if (prev_buf != scan->xs_cbuf)
605  }
606 
607  /* Obtain share-lock on the buffer so we can examine visibility */
609  got_heap_tuple = heap_hot_search_buffer(tid, scan->heapRelation,
610  scan->xs_cbuf,
611  scan->xs_snapshot,
612  &scan->xs_ctup,
613  &all_dead,
614  !scan->xs_continue_hot);
616 
617  if (got_heap_tuple)
618  {
619  /*
620  * Only in a non-MVCC snapshot can more than one member of the HOT
621  * chain be visible.
622  */
625  return &scan->xs_ctup;
626  }
627 
628  /* We've reached the end of the HOT chain. */
629  scan->xs_continue_hot = false;
630 
631  /*
632  * If we scanned a whole HOT chain and found only dead tuples, tell index
633  * AM to kill its entry for that TID (this will take effect in the next
634  * amgettuple call, in index_getnext_tid). We do not do this when in
635  * recovery because it may violate MVCC to do so. See comments in
636  * RelationGetIndexScan().
637  */
638  if (!scan->xactStartedInRecovery)
639  scan->kill_prior_tuple = all_dead;
640 
641  return NULL;
642 }
#define BUFFER_LOCK_UNLOCK
Definition: bufmgr.h:87
Snapshot xs_snapshot
Definition: relscan.h:92
Relation indexRelation
Definition: relscan.h:91
Relation heapRelation
Definition: relscan.h:90
bool heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer, Snapshot snapshot, HeapTuple heapTuple, bool *all_dead, bool first_call)
Definition: heapam.c:2034
Buffer xs_cbuf
Definition: relscan.h:122
ItemPointerData t_self
Definition: htup.h:65
#define pgstat_count_heap_fetch(rel)
Definition: pgstat.h:1286
bool xactStartedInRecovery
Definition: relscan.h:103
bool xs_continue_hot
Definition: relscan.h:138
void LockBuffer(Buffer buffer, int mode)
Definition: bufmgr.c:3546
#define IsMVCCSnapshot(snapshot)
Definition: tqual.h:31
HeapTupleData xs_ctup
Definition: relscan.h:121
Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation, BlockNumber blockNum)
Definition: bufmgr.c:1513
bool kill_prior_tuple
Definition: relscan.h:101
#define BUFFER_LOCK_SHARE
Definition: bufmgr.h:88
void heap_page_prune_opt(Relation relation, Buffer buffer)
Definition: pruneheap.c:74
#define ItemPointerGetBlockNumber(pointer)
Definition: itemptr.h:76
int Buffer
Definition: buf.h:23

◆ index_getbitmap()

int64 index_getbitmap ( IndexScanDesc  scan,
TIDBitmap bitmap 
)

Definition at line 714 of file indexam.c.

References IndexAmRoutine::amgetbitmap, CHECK_SCAN_PROCEDURE, IndexScanDescData::indexRelation, IndexScanDescData::kill_prior_tuple, pgstat_count_index_tuples, RelationData::rd_amroutine, and SCAN_CHECKS.

Referenced by MultiExecBitmapIndexScan().

715 {
716  int64 ntids;
717 
718  SCAN_CHECKS;
719  CHECK_SCAN_PROCEDURE(amgetbitmap);
720 
721  /* just make sure this is false... */
722  scan->kill_prior_tuple = false;
723 
724  /*
725  * have the am's getbitmap proc do all the work.
726  */
727  ntids = scan->indexRelation->rd_amroutine->amgetbitmap(scan, bitmap);
728 
730 
731  return ntids;
732 }
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
#define CHECK_SCAN_PROCEDURE(pname)
Definition: indexam.c:119
Relation indexRelation
Definition: relscan.h:91
amgetbitmap_function amgetbitmap
Definition: amapi.h:211
#define SCAN_CHECKS
Definition: indexam.c:105
#define pgstat_count_index_tuples(rel, n)
Definition: pgstat.h:1296
bool kill_prior_tuple
Definition: relscan.h:101

◆ index_getnext()

HeapTuple index_getnext ( IndexScanDesc  scan,
ScanDirection  direction 
)

Definition at line 660 of file indexam.c.

References Assert, BufferGetBlockNumber(), BufferIsValid, index_fetch_heap(), index_getnext_tid(), ItemPointerGetBlockNumber, HeapTupleData::t_self, IndexScanDescData::xs_cbuf, IndexScanDescData::xs_continue_hot, and IndexScanDescData::xs_ctup.

Referenced by check_exclusion_or_unique_constraint(), copy_heap_data(), get_actual_variable_range(), IndexNext(), IndexNextWithReorder(), RelationFindReplTupleByIndex(), systable_getnext(), and systable_getnext_ordered().

661 {
662  HeapTuple heapTuple;
663  ItemPointer tid;
664 
665  for (;;)
666  {
667  if (scan->xs_continue_hot)
668  {
669  /*
670  * We are resuming scan of a HOT chain after having returned an
671  * earlier member. Must still hold pin on current heap page.
672  */
673  Assert(BufferIsValid(scan->xs_cbuf));
676  }
677  else
678  {
679  /* Time to fetch the next TID from the index */
680  tid = index_getnext_tid(scan, direction);
681 
682  /* If we're out of index entries, we're done */
683  if (tid == NULL)
684  break;
685  }
686 
687  /*
688  * Fetch the next (or only) visible heap tuple for this index entry.
689  * If we don't find anything, loop around and grab the next TID from
690  * the index.
691  */
692  heapTuple = index_fetch_heap(scan);
693  if (heapTuple != NULL)
694  return heapTuple;
695  }
696 
697  return NULL; /* failure exit */
698 }
ItemPointer index_getnext_tid(IndexScanDesc scan, ScanDirection direction)
Definition: indexam.c:527
Buffer xs_cbuf
Definition: relscan.h:122
ItemPointerData t_self
Definition: htup.h:65
HeapTuple index_fetch_heap(IndexScanDesc scan)
Definition: indexam.c:584
bool xs_continue_hot
Definition: relscan.h:138
#define Assert(condition)
Definition: c.h:688
HeapTupleData xs_ctup
Definition: relscan.h:121
#define BufferIsValid(bufnum)
Definition: bufmgr.h:114
BlockNumber BufferGetBlockNumber(Buffer buffer)
Definition: bufmgr.c:2605
#define ItemPointerGetBlockNumber(pointer)
Definition: itemptr.h:76

◆ index_getnext_tid()

ItemPointer index_getnext_tid ( IndexScanDesc  scan,
ScanDirection  direction 
)

Definition at line 527 of file indexam.c.

References IndexAmRoutine::amgettuple, Assert, BufferIsValid, CHECK_SCAN_PROCEDURE, IndexScanDescData::indexRelation, InvalidBuffer, IndexScanDescData::kill_prior_tuple, pgstat_count_index_tuples, RelationData::rd_amroutine, RecentGlobalXmin, ReleaseBuffer(), SCAN_CHECKS, HeapTupleData::t_self, TransactionIdIsValid, IndexScanDescData::xs_cbuf, and IndexScanDescData::xs_ctup.

Referenced by index_getnext(), and IndexOnlyNext().

528 {
529  bool found;
530 
531  SCAN_CHECKS;
532  CHECK_SCAN_PROCEDURE(amgettuple);
533 
535 
536  /*
537  * The AM's amgettuple proc finds the next index entry matching the scan
538  * keys, and puts the TID into scan->xs_ctup.t_self. It should also set
539  * scan->xs_recheck and possibly scan->xs_itup/scan->xs_hitup, though we
540  * pay no attention to those fields here.
541  */
542  found = scan->indexRelation->rd_amroutine->amgettuple(scan, direction);
543 
544  /* Reset kill flag immediately for safety */
545  scan->kill_prior_tuple = false;
546 
547  /* If we're out of index entries, we're done */
548  if (!found)
549  {
550  /* ... but first, release any held pin on a heap page */
551  if (BufferIsValid(scan->xs_cbuf))
552  {
553  ReleaseBuffer(scan->xs_cbuf);
554  scan->xs_cbuf = InvalidBuffer;
555  }
556  return NULL;
557  }
558 
560 
561  /* Return the TID of the tuple we found. */
562  return &scan->xs_ctup.t_self;
563 }
amgettuple_function amgettuple
Definition: amapi.h:210
#define InvalidBuffer
Definition: buf.h:25
void ReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:3309
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
#define CHECK_SCAN_PROCEDURE(pname)
Definition: indexam.c:119
Relation indexRelation
Definition: relscan.h:91
Buffer xs_cbuf
Definition: relscan.h:122
ItemPointerData t_self
Definition: htup.h:65
TransactionId RecentGlobalXmin
Definition: snapmgr.c:166
#define Assert(condition)
Definition: c.h:688
HeapTupleData xs_ctup
Definition: relscan.h:121
#define SCAN_CHECKS
Definition: indexam.c:105
#define BufferIsValid(bufnum)
Definition: bufmgr.h:114
#define pgstat_count_index_tuples(rel, n)
Definition: pgstat.h:1296
bool kill_prior_tuple
Definition: relscan.h:101
#define TransactionIdIsValid(xid)
Definition: transam.h:41

◆ index_getprocid()

RegProcedure index_getprocid ( Relation  irel,
AttrNumber  attnum,
uint16  procnum 
)

Definition at line 822 of file indexam.c.

References IndexAmRoutine::amsupport, Assert, RelationData::rd_amroutine, and RelationData::rd_support.

Referenced by _hash_init(), gistcanreturn(), inclusion_get_procinfo(), initGinState(), initGISTstate(), spgdoinsert(), and spgGetCache().

825 {
826  RegProcedure *loc;
827  int nproc;
828  int procindex;
829 
830  nproc = irel->rd_amroutine->amsupport;
831 
832  Assert(procnum > 0 && procnum <= (uint16) nproc);
833 
834  procindex = (nproc * (attnum - 1)) + (procnum - 1);
835 
836  loc = irel->rd_support;
837 
838  Assert(loc != NULL);
839 
840  return loc[procindex];
841 }
uint16 amsupport
Definition: amapi.h:169
regproc RegProcedure
Definition: c.h:461
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
unsigned short uint16
Definition: c.h:313
RegProcedure * rd_support
Definition: rel.h:184
#define Assert(condition)
Definition: c.h:688

◆ index_getprocinfo()

FmgrInfo* index_getprocinfo ( Relation  irel,
AttrNumber  attnum,
uint16  procnum 
)

Definition at line 856 of file indexam.c.

References IndexAmRoutine::amsupport, Assert, elog, ERROR, fmgr_info_cxt(), FmgrInfo::fn_oid, InvalidOid, RelationData::rd_amroutine, RelationData::rd_indexcxt, RelationData::rd_support, RelationData::rd_supportinfo, RegProcedureIsValid, and RelationGetRelationName.

Referenced by _bt_first(), _bt_mkscankey(), _bt_mkscankey_nodata(), _hash_datum2hashkey(), brin_build_desc(), brinbuildCallback(), bringetbitmap(), brininsert(), doPickSplit(), inclusion_get_procinfo(), initBloomState(), initGinState(), initGISTstate(), spgdoinsert(), spgGetCache(), spgLeafTest(), spgWalk(), and union_tuples().

859 {
860  FmgrInfo *locinfo;
861  int nproc;
862  int procindex;
863 
864  nproc = irel->rd_amroutine->amsupport;
865 
866  Assert(procnum > 0 && procnum <= (uint16) nproc);
867 
868  procindex = (nproc * (attnum - 1)) + (procnum - 1);
869 
870  locinfo = irel->rd_supportinfo;
871 
872  Assert(locinfo != NULL);
873 
874  locinfo += procindex;
875 
876  /* Initialize the lookup info if first time through */
877  if (locinfo->fn_oid == InvalidOid)
878  {
879  RegProcedure *loc = irel->rd_support;
880  RegProcedure procId;
881 
882  Assert(loc != NULL);
883 
884  procId = loc[procindex];
885 
886  /*
887  * Complain if function was not found during IndexSupportInitialize.
888  * This should not happen unless the system tables contain bogus
889  * entries for the index opclass. (If an AM wants to allow a support
890  * function to be optional, it can use index_getprocid.)
891  */
892  if (!RegProcedureIsValid(procId))
893  elog(ERROR, "missing support function %d for attribute %d of index \"%s\"",
894  procnum, attnum, RelationGetRelationName(irel));
895 
896  fmgr_info_cxt(procId, locinfo, irel->rd_indexcxt);
897  }
898 
899  return locinfo;
900 }
Definition: fmgr.h:56
uint16 amsupport
Definition: amapi.h:169
FmgrInfo * rd_supportinfo
Definition: rel.h:185
regproc RegProcedure
Definition: c.h:461
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
unsigned short uint16
Definition: c.h:313
#define ERROR
Definition: elog.h:43
#define RegProcedureIsValid(p)
Definition: c.h:596
#define RelationGetRelationName(relation)
Definition: rel.h:445
void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt)
Definition: fmgr.c:132
RegProcedure * rd_support
Definition: rel.h:184
#define InvalidOid
Definition: postgres_ext.h:36
Oid fn_oid
Definition: fmgr.h:59
#define Assert(condition)
Definition: c.h:688
MemoryContext rd_indexcxt
Definition: rel.h:179
#define elog
Definition: elog.h:219

◆ index_insert()

bool index_insert ( Relation  indexRelation,
Datum values,
bool isnull,
ItemPointer  heap_t_ctid,
Relation  heapRelation,
IndexUniqueCheck  checkUnique,
IndexInfo indexInfo 
)

Definition at line 195 of file indexam.c.

References IndexAmRoutine::aminsert, IndexAmRoutine::ampredlocks, CHECK_REL_PROCEDURE, CheckForSerializableConflictIn(), InvalidBuffer, RelationData::rd_amroutine, and RELATION_CHECKS.

Referenced by CatalogIndexInsert(), ExecInsertIndexTuples(), toast_save_datum(), unique_key_recheck(), and validate_index_heapscan().

202 {
204  CHECK_REL_PROCEDURE(aminsert);
205 
206  if (!(indexRelation->rd_amroutine->ampredlocks))
207  CheckForSerializableConflictIn(indexRelation,
208  (HeapTuple) NULL,
209  InvalidBuffer);
210 
211  return indexRelation->rd_amroutine->aminsert(indexRelation, values, isnull,
212  heap_t_ctid, heapRelation,
213  checkUnique, indexInfo);
214 }
#define RELATION_CHECKS
Definition: indexam.c:98
#define InvalidBuffer
Definition: buf.h:25
bool ampredlocks
Definition: amapi.h:191
aminsert_function aminsert
Definition: amapi.h:200
void CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer)
Definition: predicate.c:4326
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
#define CHECK_REL_PROCEDURE(pname)
Definition: indexam.c:112
static Datum values[MAXATTR]
Definition: bootstrap.c:164

◆ index_markpos()

void index_markpos ( IndexScanDesc  scan)

Definition at line 371 of file indexam.c.

References IndexAmRoutine::ammarkpos, CHECK_SCAN_PROCEDURE, IndexScanDescData::indexRelation, RelationData::rd_amroutine, and SCAN_CHECKS.

Referenced by ExecIndexMarkPos(), and ExecIndexOnlyMarkPos().

372 {
373  SCAN_CHECKS;
374  CHECK_SCAN_PROCEDURE(ammarkpos);
375 
376  scan->indexRelation->rd_amroutine->ammarkpos(scan);
377 }
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
#define CHECK_SCAN_PROCEDURE(pname)
Definition: indexam.c:119
Relation indexRelation
Definition: relscan.h:91
#define SCAN_CHECKS
Definition: indexam.c:105
ammarkpos_function ammarkpos
Definition: amapi.h:213

◆ index_open()

Relation index_open ( Oid  relationId,
LOCKMODE  lockmode 
)

Definition at line 151 of file indexam.c.

References ereport, errcode(), errmsg(), ERROR, RelationData::rd_rel, relation_open(), RelationGetRelationName, RELKIND_INDEX, and RELKIND_PARTITIONED_INDEX.

Referenced by _bt_parallel_build_main(), ATExecAddIndex(), ATExecAddIndexConstraint(), ATExecDetachPartition(), ATExecReplicaIdentity(), AttachPartitionEnsureIndexes(), brin_desummarize_range(), brin_page_items(), brin_summarize_range(), brincostestimate(), bt_index_check_internal(), build_indices(), BuildEventTriggerCache(), check_index_is_clusterable(), CheckIndexCompatible(), copy_heap_data(), DefineIndex(), DefineRelation(), enum_endpoint(), enum_range_internal(), ExecInitBitmapIndexScan(), ExecInitIndexOnlyScan(), ExecInitIndexScan(), ExecOpenIndices(), ExecRefreshMatView(), get_actual_variable_range(), get_relation_info(), gin_clean_pending_list(), gincostestimate(), hash_bitmap_info(), index_drop(), indexam_property(), infer_arbiter_indexes(), InitCatCachePhase2(), lookup_ts_config_cache(), open_lo_relation(), pgstathashindex(), plan_create_index_workers(), refresh_by_match_merge(), reindex_index(), ReindexIndex(), RelationFindReplTupleByIndex(), RelationGetIndexAttrBitmap(), RelationTruncateIndexes(), systable_beginscan(), toast_open_indexes(), transformIndexConstraint(), transformTableLikeClause(), TryReuseIndex(), unique_key_recheck(), vac_open_indexes(), and validate_index().

152 {
153  Relation r;
154 
155  r = relation_open(relationId, lockmode);
156 
157  if (r->rd_rel->relkind != RELKIND_INDEX &&
158  r->rd_rel->relkind != RELKIND_PARTITIONED_INDEX)
159  ereport(ERROR,
160  (errcode(ERRCODE_WRONG_OBJECT_TYPE),
161  errmsg("\"%s\" is not an index",
163 
164  return r;
165 }
int errcode(int sqlerrcode)
Definition: elog.c:575
Form_pg_class rd_rel
Definition: rel.h:114
#define ERROR
Definition: elog.h:43
#define RelationGetRelationName(relation)
Definition: rel.h:445
#define ereport(elevel, rest)
Definition: elog.h:122
#define RELKIND_PARTITIONED_INDEX
Definition: pg_class.h:169
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define RELKIND_INDEX
Definition: pg_class.h:161
Relation relation_open(Oid relationId, LOCKMODE lockmode)
Definition: heapam.c:1120

◆ index_parallelrescan()

void index_parallelrescan ( IndexScanDesc  scan)

Definition at line 482 of file indexam.c.

References IndexAmRoutine::amparallelrescan, IndexScanDescData::indexRelation, RelationData::rd_amroutine, and SCAN_CHECKS.

Referenced by ExecIndexOnlyScanReInitializeDSM(), and ExecIndexScanReInitializeDSM().

483 {
484  SCAN_CHECKS;
485 
486  /* amparallelrescan is optional; assume no-op if not provided by AM */
487  if (scan->indexRelation->rd_amroutine->amparallelrescan != NULL)
489 }
amparallelrescan_function amparallelrescan
Definition: amapi.h:219
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
Relation indexRelation
Definition: relscan.h:91
#define SCAN_CHECKS
Definition: indexam.c:105

◆ index_parallelscan_estimate()

Size index_parallelscan_estimate ( Relation  indexRelation,
Snapshot  snapshot 
)

Definition at line 418 of file indexam.c.

References add_size(), IndexAmRoutine::amestimateparallelscan, EstimateSnapshotSpace(), MAXALIGN, offsetof, RelationData::rd_amroutine, and RELATION_CHECKS.

Referenced by ExecIndexOnlyScanEstimate(), and ExecIndexScanEstimate().

419 {
420  Size nbytes;
421 
423 
424  nbytes = offsetof(ParallelIndexScanDescData, ps_snapshot_data);
425  nbytes = add_size(nbytes, EstimateSnapshotSpace(snapshot));
426  nbytes = MAXALIGN(nbytes);
427 
428  /*
429  * If amestimateparallelscan is not provided, assume there is no
430  * AM-specific data needed. (It's hard to believe that could work, but
431  * it's easy enough to cater to it here.)
432  */
433  if (indexRelation->rd_amroutine->amestimateparallelscan != NULL)
434  nbytes = add_size(nbytes,
435  indexRelation->rd_amroutine->amestimateparallelscan());
436 
437  return nbytes;
438 }
#define RELATION_CHECKS
Definition: indexam.c:98
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
Size EstimateSnapshotSpace(Snapshot snap)
Definition: snapmgr.c:2044
Size add_size(Size s1, Size s2)
Definition: shmem.c:475
size_t Size
Definition: c.h:422
#define MAXALIGN(LEN)
Definition: c.h:641
amestimateparallelscan_function amestimateparallelscan
Definition: amapi.h:217
#define offsetof(type, field)
Definition: c.h:611

◆ index_parallelscan_initialize()

void index_parallelscan_initialize ( Relation  heapRelation,
Relation  indexRelation,
Snapshot  snapshot,
ParallelIndexScanDesc  target 
)

Definition at line 451 of file indexam.c.

References add_size(), IndexAmRoutine::aminitparallelscan, EstimateSnapshotSpace(), MAXALIGN, offsetof, OffsetToPointer, ParallelIndexScanDescData::ps_indexid, ParallelIndexScanDescData::ps_offset, ParallelIndexScanDescData::ps_relid, ParallelIndexScanDescData::ps_snapshot_data, RelationData::rd_amroutine, RELATION_CHECKS, RelationGetRelid, and SerializeSnapshot().

Referenced by ExecIndexOnlyScanInitializeDSM(), and ExecIndexScanInitializeDSM().

453 {
454  Size offset;
455 
457 
458  offset = add_size(offsetof(ParallelIndexScanDescData, ps_snapshot_data),
459  EstimateSnapshotSpace(snapshot));
460  offset = MAXALIGN(offset);
461 
462  target->ps_relid = RelationGetRelid(heapRelation);
463  target->ps_indexid = RelationGetRelid(indexRelation);
464  target->ps_offset = offset;
465  SerializeSnapshot(snapshot, target->ps_snapshot_data);
466 
467  /* aminitparallelscan is optional; assume no-op if not provided by AM */
468  if (indexRelation->rd_amroutine->aminitparallelscan != NULL)
469  {
470  void *amtarget;
471 
472  amtarget = OffsetToPointer(target, offset);
473  indexRelation->rd_amroutine->aminitparallelscan(amtarget);
474  }
475 }
#define RELATION_CHECKS
Definition: indexam.c:98
char ps_snapshot_data[FLEXIBLE_ARRAY_MEMBER]
Definition: relscan.h:150
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
void SerializeSnapshot(Snapshot snapshot, char *start_address)
Definition: snapmgr.c:2068
#define OffsetToPointer(base, offset)
Definition: c.h:591
Size EstimateSnapshotSpace(Snapshot snap)
Definition: snapmgr.c:2044
Size add_size(Size s1, Size s2)
Definition: shmem.c:475
size_t Size
Definition: c.h:422
#define MAXALIGN(LEN)
Definition: c.h:641
#define RelationGetRelid(relation)
Definition: rel.h:425
#define offsetof(type, field)
Definition: c.h:611
aminitparallelscan_function aminitparallelscan
Definition: amapi.h:218

◆ index_rescan()

void index_rescan ( IndexScanDesc  scan,
ScanKey  keys,
int  nkeys,
ScanKey  orderbys,
int  norderbys 
)

Definition at line 311 of file indexam.c.

References IndexAmRoutine::amrescan, Assert, BufferIsValid, CHECK_SCAN_PROCEDURE, IndexScanDescData::indexRelation, InvalidBuffer, IndexScanDescData::kill_prior_tuple, IndexScanDescData::numberOfKeys, IndexScanDescData::numberOfOrderBys, RelationData::rd_amroutine, ReleaseBuffer(), SCAN_CHECKS, IndexScanDescData::xs_cbuf, and IndexScanDescData::xs_continue_hot.

Referenced by check_exclusion_or_unique_constraint(), copy_heap_data(), ExecIndexOnlyScanInitializeDSM(), ExecIndexOnlyScanInitializeWorker(), ExecIndexScanInitializeDSM(), ExecIndexScanInitializeWorker(), ExecInitBitmapIndexScan(), ExecReScanBitmapIndexScan(), ExecReScanIndexOnlyScan(), ExecReScanIndexScan(), get_actual_variable_range(), IndexNext(), IndexNextWithReorder(), IndexOnlyNext(), MultiExecBitmapIndexScan(), RelationFindReplTupleByIndex(), systable_beginscan(), and systable_beginscan_ordered().

314 {
315  SCAN_CHECKS;
316  CHECK_SCAN_PROCEDURE(amrescan);
317 
318  Assert(nkeys == scan->numberOfKeys);
319  Assert(norderbys == scan->numberOfOrderBys);
320 
321  /* Release any held pin on a heap page */
322  if (BufferIsValid(scan->xs_cbuf))
323  {
324  ReleaseBuffer(scan->xs_cbuf);
325  scan->xs_cbuf = InvalidBuffer;
326  }
327 
328  scan->xs_continue_hot = false;
329 
330  scan->kill_prior_tuple = false; /* for safety */
331 
332  scan->indexRelation->rd_amroutine->amrescan(scan, keys, nkeys,
333  orderbys, norderbys);
334 }
#define InvalidBuffer
Definition: buf.h:25
void ReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:3309
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
#define CHECK_SCAN_PROCEDURE(pname)
Definition: indexam.c:119
Relation indexRelation
Definition: relscan.h:91
Buffer xs_cbuf
Definition: relscan.h:122
bool xs_continue_hot
Definition: relscan.h:138
amrescan_function amrescan
Definition: amapi.h:209
#define Assert(condition)
Definition: c.h:688
#define SCAN_CHECKS
Definition: indexam.c:105
#define BufferIsValid(bufnum)
Definition: bufmgr.h:114
bool kill_prior_tuple
Definition: relscan.h:101
int numberOfOrderBys
Definition: relscan.h:94

◆ index_restrpos()

void index_restrpos ( IndexScanDesc  scan)

Definition at line 396 of file indexam.c.

References IndexAmRoutine::amrestrpos, Assert, CHECK_SCAN_PROCEDURE, IndexScanDescData::indexRelation, IsMVCCSnapshot, IndexScanDescData::kill_prior_tuple, RelationData::rd_amroutine, SCAN_CHECKS, IndexScanDescData::xs_continue_hot, and IndexScanDescData::xs_snapshot.

Referenced by ExecIndexOnlyRestrPos(), and ExecIndexRestrPos().

397 {
399 
400  SCAN_CHECKS;
401  CHECK_SCAN_PROCEDURE(amrestrpos);
402 
403  scan->xs_continue_hot = false;
404 
405  scan->kill_prior_tuple = false; /* for safety */
406 
407  scan->indexRelation->rd_amroutine->amrestrpos(scan);
408 }
Snapshot xs_snapshot
Definition: relscan.h:92
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
#define CHECK_SCAN_PROCEDURE(pname)
Definition: indexam.c:119
Relation indexRelation
Definition: relscan.h:91
bool xs_continue_hot
Definition: relscan.h:138
#define Assert(condition)
Definition: c.h:688
#define IsMVCCSnapshot(snapshot)
Definition: tqual.h:31
#define SCAN_CHECKS
Definition: indexam.c:105
bool kill_prior_tuple
Definition: relscan.h:101
amrestrpos_function amrestrpos
Definition: amapi.h:214

◆ index_vacuum_cleanup()

IndexBulkDeleteResult* index_vacuum_cleanup ( IndexVacuumInfo info,
IndexBulkDeleteResult stats 
)

Definition at line 765 of file indexam.c.

References IndexAmRoutine::amvacuumcleanup, CHECK_REL_PROCEDURE, IndexVacuumInfo::index, RelationData::rd_amroutine, and RELATION_CHECKS.

Referenced by do_analyze_rel(), and lazy_cleanup_index().

767 {
768  Relation indexRelation = info->index;
769 
771  CHECK_REL_PROCEDURE(amvacuumcleanup);
772 
773  return indexRelation->rd_amroutine->amvacuumcleanup(info, stats);
774 }
#define RELATION_CHECKS
Definition: indexam.c:98
Relation index
Definition: genam.h:46
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
#define CHECK_REL_PROCEDURE(pname)
Definition: indexam.c:112
amvacuumcleanup_function amvacuumcleanup
Definition: amapi.h:202