mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Rename RelationData.rd_amroutine to rd_indam.
The upcoming table AM support makes rd_amroutine to generic, as its only about index AMs. The new name makes that clear, and is shorter to boot. Author: Andres Freund Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
This commit is contained in:
@@ -98,7 +98,7 @@
|
||||
#define RELATION_CHECKS \
|
||||
( \
|
||||
AssertMacro(RelationIsValid(indexRelation)), \
|
||||
AssertMacro(PointerIsValid(indexRelation->rd_amroutine)), \
|
||||
AssertMacro(PointerIsValid(indexRelation->rd_indam)), \
|
||||
AssertMacro(!ReindexIsProcessingIndex(RelationGetRelid(indexRelation))) \
|
||||
)
|
||||
|
||||
@@ -106,19 +106,19 @@
|
||||
( \
|
||||
AssertMacro(IndexScanIsValid(scan)), \
|
||||
AssertMacro(RelationIsValid(scan->indexRelation)), \
|
||||
AssertMacro(PointerIsValid(scan->indexRelation->rd_amroutine)) \
|
||||
AssertMacro(PointerIsValid(scan->indexRelation->rd_indam)) \
|
||||
)
|
||||
|
||||
#define CHECK_REL_PROCEDURE(pname) \
|
||||
do { \
|
||||
if (indexRelation->rd_amroutine->pname == NULL) \
|
||||
if (indexRelation->rd_indam->pname == NULL) \
|
||||
elog(ERROR, "function %s is not defined for index %s", \
|
||||
CppAsString(pname), RelationGetRelationName(indexRelation)); \
|
||||
} while(0)
|
||||
|
||||
#define CHECK_SCAN_PROCEDURE(pname) \
|
||||
do { \
|
||||
if (scan->indexRelation->rd_amroutine->pname == NULL) \
|
||||
if (scan->indexRelation->rd_indam->pname == NULL) \
|
||||
elog(ERROR, "function %s is not defined for index %s", \
|
||||
CppAsString(pname), RelationGetRelationName(scan->indexRelation)); \
|
||||
} while(0)
|
||||
@@ -203,14 +203,14 @@ index_insert(Relation indexRelation,
|
||||
RELATION_CHECKS;
|
||||
CHECK_REL_PROCEDURE(aminsert);
|
||||
|
||||
if (!(indexRelation->rd_amroutine->ampredlocks))
|
||||
if (!(indexRelation->rd_indam->ampredlocks))
|
||||
CheckForSerializableConflictIn(indexRelation,
|
||||
(HeapTuple) NULL,
|
||||
InvalidBuffer);
|
||||
|
||||
return indexRelation->rd_amroutine->aminsert(indexRelation, values, isnull,
|
||||
heap_t_ctid, heapRelation,
|
||||
checkUnique, indexInfo);
|
||||
return indexRelation->rd_indam->aminsert(indexRelation, values, isnull,
|
||||
heap_t_ctid, heapRelation,
|
||||
checkUnique, indexInfo);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -275,7 +275,7 @@ index_beginscan_internal(Relation indexRelation,
|
||||
RELATION_CHECKS;
|
||||
CHECK_REL_PROCEDURE(ambeginscan);
|
||||
|
||||
if (!(indexRelation->rd_amroutine->ampredlocks))
|
||||
if (!(indexRelation->rd_indam->ampredlocks))
|
||||
PredicateLockRelation(indexRelation, snapshot);
|
||||
|
||||
/*
|
||||
@@ -286,8 +286,8 @@ index_beginscan_internal(Relation indexRelation,
|
||||
/*
|
||||
* Tell the AM to open a scan.
|
||||
*/
|
||||
scan = indexRelation->rd_amroutine->ambeginscan(indexRelation, nkeys,
|
||||
norderbys);
|
||||
scan = indexRelation->rd_indam->ambeginscan(indexRelation, nkeys,
|
||||
norderbys);
|
||||
/* Initialize information for parallel scan. */
|
||||
scan->parallel_scan = pscan;
|
||||
scan->xs_temp_snap = temp_snap;
|
||||
@@ -329,8 +329,8 @@ index_rescan(IndexScanDesc scan,
|
||||
|
||||
scan->kill_prior_tuple = false; /* for safety */
|
||||
|
||||
scan->indexRelation->rd_amroutine->amrescan(scan, keys, nkeys,
|
||||
orderbys, norderbys);
|
||||
scan->indexRelation->rd_indam->amrescan(scan, keys, nkeys,
|
||||
orderbys, norderbys);
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
@@ -351,7 +351,7 @@ index_endscan(IndexScanDesc scan)
|
||||
}
|
||||
|
||||
/* End the AM's scan */
|
||||
scan->indexRelation->rd_amroutine->amendscan(scan);
|
||||
scan->indexRelation->rd_indam->amendscan(scan);
|
||||
|
||||
/* Release index refcount acquired by index_beginscan */
|
||||
RelationDecrementReferenceCount(scan->indexRelation);
|
||||
@@ -373,7 +373,7 @@ index_markpos(IndexScanDesc scan)
|
||||
SCAN_CHECKS;
|
||||
CHECK_SCAN_PROCEDURE(ammarkpos);
|
||||
|
||||
scan->indexRelation->rd_amroutine->ammarkpos(scan);
|
||||
scan->indexRelation->rd_indam->ammarkpos(scan);
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
@@ -404,7 +404,7 @@ index_restrpos(IndexScanDesc scan)
|
||||
|
||||
scan->kill_prior_tuple = false; /* for safety */
|
||||
|
||||
scan->indexRelation->rd_amroutine->amrestrpos(scan);
|
||||
scan->indexRelation->rd_indam->amrestrpos(scan);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -430,9 +430,9 @@ index_parallelscan_estimate(Relation indexRelation, Snapshot snapshot)
|
||||
* AM-specific data needed. (It's hard to believe that could work, but
|
||||
* it's easy enough to cater to it here.)
|
||||
*/
|
||||
if (indexRelation->rd_amroutine->amestimateparallelscan != NULL)
|
||||
if (indexRelation->rd_indam->amestimateparallelscan != NULL)
|
||||
nbytes = add_size(nbytes,
|
||||
indexRelation->rd_amroutine->amestimateparallelscan());
|
||||
indexRelation->rd_indam->amestimateparallelscan());
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
@@ -465,12 +465,12 @@ index_parallelscan_initialize(Relation heapRelation, Relation indexRelation,
|
||||
SerializeSnapshot(snapshot, target->ps_snapshot_data);
|
||||
|
||||
/* aminitparallelscan is optional; assume no-op if not provided by AM */
|
||||
if (indexRelation->rd_amroutine->aminitparallelscan != NULL)
|
||||
if (indexRelation->rd_indam->aminitparallelscan != NULL)
|
||||
{
|
||||
void *amtarget;
|
||||
|
||||
amtarget = OffsetToPointer(target, offset);
|
||||
indexRelation->rd_amroutine->aminitparallelscan(amtarget);
|
||||
indexRelation->rd_indam->aminitparallelscan(amtarget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -484,8 +484,8 @@ index_parallelrescan(IndexScanDesc scan)
|
||||
SCAN_CHECKS;
|
||||
|
||||
/* amparallelrescan is optional; assume no-op if not provided by AM */
|
||||
if (scan->indexRelation->rd_amroutine->amparallelrescan != NULL)
|
||||
scan->indexRelation->rd_amroutine->amparallelrescan(scan);
|
||||
if (scan->indexRelation->rd_indam->amparallelrescan != NULL)
|
||||
scan->indexRelation->rd_indam->amparallelrescan(scan);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -539,7 +539,7 @@ index_getnext_tid(IndexScanDesc scan, ScanDirection direction)
|
||||
* scan->xs_recheck and possibly scan->xs_itup/scan->xs_hitup, though we
|
||||
* pay no attention to those fields here.
|
||||
*/
|
||||
found = scan->indexRelation->rd_amroutine->amgettuple(scan, direction);
|
||||
found = scan->indexRelation->rd_indam->amgettuple(scan, direction);
|
||||
|
||||
/* Reset kill flag immediately for safety */
|
||||
scan->kill_prior_tuple = false;
|
||||
@@ -724,7 +724,7 @@ index_getbitmap(IndexScanDesc scan, TIDBitmap *bitmap)
|
||||
/*
|
||||
* have the am's getbitmap proc do all the work.
|
||||
*/
|
||||
ntids = scan->indexRelation->rd_amroutine->amgetbitmap(scan, bitmap);
|
||||
ntids = scan->indexRelation->rd_indam->amgetbitmap(scan, bitmap);
|
||||
|
||||
pgstat_count_index_tuples(scan->indexRelation, ntids);
|
||||
|
||||
@@ -751,8 +751,8 @@ index_bulk_delete(IndexVacuumInfo *info,
|
||||
RELATION_CHECKS;
|
||||
CHECK_REL_PROCEDURE(ambulkdelete);
|
||||
|
||||
return indexRelation->rd_amroutine->ambulkdelete(info, stats,
|
||||
callback, callback_state);
|
||||
return indexRelation->rd_indam->ambulkdelete(info, stats,
|
||||
callback, callback_state);
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
@@ -770,7 +770,7 @@ index_vacuum_cleanup(IndexVacuumInfo *info,
|
||||
RELATION_CHECKS;
|
||||
CHECK_REL_PROCEDURE(amvacuumcleanup);
|
||||
|
||||
return indexRelation->rd_amroutine->amvacuumcleanup(info, stats);
|
||||
return indexRelation->rd_indam->amvacuumcleanup(info, stats);
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
@@ -786,10 +786,10 @@ index_can_return(Relation indexRelation, int attno)
|
||||
RELATION_CHECKS;
|
||||
|
||||
/* amcanreturn is optional; assume false if not provided by AM */
|
||||
if (indexRelation->rd_amroutine->amcanreturn == NULL)
|
||||
if (indexRelation->rd_indam->amcanreturn == NULL)
|
||||
return false;
|
||||
|
||||
return indexRelation->rd_amroutine->amcanreturn(indexRelation, attno);
|
||||
return indexRelation->rd_indam->amcanreturn(indexRelation, attno);
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
@@ -827,7 +827,7 @@ index_getprocid(Relation irel,
|
||||
int nproc;
|
||||
int procindex;
|
||||
|
||||
nproc = irel->rd_amroutine->amsupport;
|
||||
nproc = irel->rd_indam->amsupport;
|
||||
|
||||
Assert(procnum > 0 && procnum <= (uint16) nproc);
|
||||
|
||||
@@ -861,7 +861,7 @@ index_getprocinfo(Relation irel,
|
||||
int nproc;
|
||||
int procindex;
|
||||
|
||||
nproc = irel->rd_amroutine->amsupport;
|
||||
nproc = irel->rd_indam->amsupport;
|
||||
|
||||
Assert(procnum > 0 && procnum <= (uint16) nproc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user