MCPcopy Create free account
hub / github.com/apache/cloudberry / InitIndexAmRoutine

Function InitIndexAmRoutine

src/backend/utils/cache/relcache.c:1447–1466  ·  view source on GitHub ↗

* Fill in the IndexAmRoutine for an index relation. * * relation's rd_amhandler and rd_indexcxt must be valid already. */

Source from the content-addressed store, hash-verified

1445 * relation's rd_amhandler and rd_indexcxt must be valid already.
1446 */
1447static void
1448InitIndexAmRoutine(Relation relation)
1449{
1450 IndexAmRoutine *cached,
1451 *tmp;
1452
1453 /*
1454 * Call the amhandler in current, short-lived memory context, just in case
1455 * it leaks anything (it probably won't, but let's be paranoid).
1456 */
1457 tmp = GetIndexAmRoutine(relation->rd_amhandler);
1458
1459 /* OK, now transfer the data into relation's rd_indexcxt. */
1460 cached = (IndexAmRoutine *) MemoryContextAlloc(relation->rd_indexcxt,
1461 sizeof(IndexAmRoutine));
1462 memcpy(cached, tmp, sizeof(IndexAmRoutine));
1463 relation->rd_indam = cached;
1464
1465 pfree(tmp);
1466}
1467
1468/*
1469 * Initialize index-access-method support data for an index relation

Callers 2

load_relcache_init_fileFunction · 0.85

Calls 3

GetIndexAmRoutineFunction · 0.85
MemoryContextAllocFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected